This commit is contained in:
mcmullen%netscape.com 1999-04-28 02:48:36 +00:00
Родитель bda4b11e44
Коммит a429bb661f
12 изменённых файлов: 1825 добавлений и 0 удалений

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

@ -0,0 +1,66 @@
<?xml version="1.0"?>
<?xml-stylesheet href="common.css" type="text/css"?>
<!DOCTYPE window>
<xul:window
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40">
<script>
function commit()
{
var element;
element = document.getElementById("ProfileName");
parent.SetValue(element.id, element.value);
element = document.getElementById("ProfileDir");
data += "ProfileDir="+element.value+"%";
parent.SetValue(element.id, element.value);
}
</script>
<table>
<tr>
<td >
If you create several profile you can tell them apart by the profile names
</td>
</tr>
<tr>
<td >
Enter New Profile name
</td>
</tr>
<tr>
<td>
<input type="text" id="ProfileName" size="30"/>
</td>
</tr>
<tr>
<td >
Your user settings will be stored in the directory below
</td>
</tr>
<tr>
<td>
<input type="text" id="ProfileDir" size="30"/>
</td>
</tr>
<tr>
<td>
Please click Next to continue
</td>
</tr>
</table>
</xul:window>

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

@ -0,0 +1,75 @@
<?xml version="1.0"?>
<?xml-stylesheet href="common.css" type="text/css"?>
<!DOCTYPE window>
<xul:window
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40">
<script>
function commit()
{
var element;
var value;
var data;
element = document.getElementById("name");
data = "ProfileName="+element.value+"%";
parent.SetValue("pname", element.value);
element = document.getElementById("email");
data += "ProfileDir="+element.value+"%";
parent.SetValue("setting", element.value);
}
</script>
<table>
<tr>
<td >
Please Enter name and information for the profile
</td>
</tr>
<tr>
<td >
Full name
</td>
</tr>
<tr>
<td>
<input type="text" id="name" size="30"/>
</td>
<td>
(e.g. John Smith)
</td>
</tr>
<tr>
<td >
Email Address if available
</td>
</tr>
<tr>
<td>
<input type="text" id="email" size="30"/>
</td>
<td >
(e.g. jsmith@company.com)
</td>
</tr>
<tr>
<td>
Please click Next to continue
</td>
</tr>
</table>
</xul:window>

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

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<?xml-stylesheet href="common.css" type="text/css"?>
<!DOCTYPE window>
<xul:window
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40">
<script>
function commit()
{
}
</script>
Communicator Profile Manager
Start creating your profile
</xul:window>

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

@ -0,0 +1,58 @@
<?xml version="1.0"?>
<?xml-stylesheet href="common.css" type="text/css"?>
<!DOCTYPE window>
<xul:window
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40">
<script>
function commit()
{
var element;
var value;
var data;
dump("GRRRRRR.....frame 4 commit called\n");
element = document.getElementById("smtp");
parent.SetValue("smtp", element.value);
}
</script>
<table>
<tr>
<td >
Please Enter information about your mail servers
</td>
</tr>
<tr>
<td >
Outgoing SMTP server
</td>
</tr>
<tr>
<td>
<input type="text" id="smtp" size="30"/>
</td>
</tr>
<tr>
<td>
Please click Next to continue entering information
</td>
</tr>
<tr>
<td>
Click Finish if you want to start communicator and enter your mail preferences later
</td>
</tr>
</table>
</xul:window>

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

@ -0,0 +1,90 @@
<?xml version="1.0"?>
<?xml-stylesheet href="common.css" type="text/css"?>
<!DOCTYPE window>
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="CreateProfile Wizard">
<html:script>
var toolkitCore;
nameGlobal = new Array();
count = 0;
function Startup()
{
dump("Doing Startup...\n");
toolkitCore = XPAppCoresManager.Find("toolkitCore");
if (!toolkitCore) {
toolkitCore = new ToolkitCore();
if (toolkitCore) {
toolkitCore.Init("toolkitCore");
}
}
}
function SetValue(name, value)
{
nameGlobal[count] = name+"="+value+"%";
count++;
}
function Finish()
{
var data = "";
var i = 0;
dump("before for loop\n");
for (i = 0; i !=count; i++) {
data = data+nameGlobal[i];
}
dump("DATA IS: "+data+"\n");
dump("calling javascript reflection\n");
var profileCore = XPAppCoresManager.Find("ProfileCore");
if (!profileCore)
{
dump("!profileCore\n");
profileCore = new ProfileCore();
dump("!profileCore\n");
if (profileCore) {
dump("after ! yes profileCore in if loop\n");
profileCore.Init("ProfileCore");
}
else {
dump("profile not created\n");
}
}
if (profileCore) {
dump("yes profileCore\n");
profileCore.CreateNewProfile(data);
}
toolkitCore = XPAppCoresManager.Find("toolkitCore");
if (!toolkitCore) {
toolkitCore = new ToolkitCore();
if (toolkitCore) {
toolkitCore.Init("toolkitCore");
}
}
if (toolkitCore) {
toolkitCore.CloseWindow(parent);
}
}
</html:script>
<html:iframe src="content1.xul" name="frame1" width="100%" height="410px"> </html:iframe>
<html:iframe src="navigation.xul" name="frame2" width="100%" height="90px"> </html:iframe>
</window>

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

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

@ -0,0 +1,108 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMProfileCore_h__
#define nsIDOMProfileCore_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMBaseAppCore.h"
#define NS_IDOMPROFILECORE_IID \
{ 0x0573a2a3, 0xf838, 0x11d2, \
{0x90, 0x6d, 0x00, 0x80, 0x5f, 0x8a, 0x08, 0xdc}}
class nsIDOMProfileCore : public nsIDOMBaseAppCore {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMPROFILECORE_IID; return iid; }
NS_IMETHOD CreateNewProfile(const nsString& aData)=0;
};
#define NS_DECL_IDOMPROFILECORE \
NS_IMETHOD CreateNewProfile(const nsString& aData); \
#define NS_FORWARD_IDOMPROFILECORE(_to) \
NS_IMETHOD CreateNewProfile(const nsString& aData) { return _to CreateNewProfile(aData); } \
extern "C" NS_DOM nsresult NS_InitProfileCoreClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptProfileCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMProfileCore_h__

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

@ -0,0 +1,700 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMProfileCore.h"
#include "nsIScriptNameSpaceManager.h"
#include "nsIComponentManager.h"
#include "nsDOMCID.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIProfileCoreIID, NS_IDOMPROFILECORE_IID);
NS_DEF_PTR(nsIDOMProfileCore);
/***********************************************************************/
//
// ProfileCore Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetProfileCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMProfileCore *a = (nsIDOMProfileCore*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// ProfileCore Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetProfileCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMProfileCore *a = (nsIDOMProfileCore*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// ProfileCore finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeProfileCore(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// ProfileCore enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateProfileCore(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// ProfileCore resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveProfileCore(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
//
// Native method CreateNewProfile
//
PR_STATIC_CALLBACK(JSBool)
ProfileCoreCreateNewProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
if (NS_OK != nativeThis->CreateNewProfile(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function CreateNewProfile requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for ProfileCore
//
JSClass ProfileCoreClass = {
"ProfileCore",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetProfileCoreProperty,
SetProfileCoreProperty,
EnumerateProfileCore,
ResolveProfileCore,
JS_ConvertStub,
FinalizeProfileCore
};
//
// ProfileCore class properties
//
static JSPropertySpec ProfileCoreProperties[] =
{
{0}
};
//
// ProfileCore class methods
//
static JSFunctionSpec ProfileCoreMethods[] =
{
{"CreateNewProfile", ProfileCoreCreateNewProfile, 1},
{0}
};
//
// ProfileCore constructor
//
PR_STATIC_CALLBACK(JSBool)
ProfileCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsresult result;
nsIID classID;
nsIScriptContext* context = (nsIScriptContext*)JS_GetContextPrivate(cx);
nsIScriptNameSpaceManager* manager;
nsIDOMProfileCore *nativeThis;
nsIScriptObjectOwner *owner = nsnull;
static NS_DEFINE_IID(kIDOMProfileCoreIID, NS_IDOMPROFILECORE_IID);
result = context->GetNameSpaceManager(&manager);
if (NS_OK != result) {
return JS_FALSE;
}
result = manager->LookupName("ProfileCore", PR_TRUE, classID);
NS_RELEASE(manager);
if (NS_OK != result) {
return JS_FALSE;
}
result = nsComponentManager::CreateInstance(classID,
nsnull,
kIDOMProfileCoreIID,
(void **)&nativeThis);
if (NS_OK != result) {
return JS_FALSE;
}
// XXX We should be calling Init() on the instance
result = nativeThis->QueryInterface(kIScriptObjectOwnerIID, (void **)&owner);
if (NS_OK != result) {
NS_RELEASE(nativeThis);
return JS_FALSE;
}
owner->SetScriptObject((void *)obj);
JS_SetPrivate(cx, obj, nativeThis);
NS_RELEASE(owner);
return JS_TRUE;
}
//
// ProfileCore class initialization
//
extern "C" NS_DOM nsresult NS_InitProfileCoreClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "ProfileCore", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitBaseAppCoreClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&ProfileCoreClass, // JSClass
ProfileCore, // JSNative ctor
0, // ctor args
ProfileCoreProperties, // proto props
ProfileCoreMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new ProfileCore JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptProfileCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptProfileCore");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMProfileCore *aProfileCore;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitProfileCoreClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIProfileCoreIID, (void **)&aProfileCore);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &ProfileCoreClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aProfileCore);
}
else {
NS_RELEASE(aProfileCore);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

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

@ -0,0 +1,354 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsProfileCore.h"
#include "nsIProfile.h"
#include "nsIURL.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsFileSpec.h"
#include "nsFileStream.h"
#include "nsIBrowserWindow.h"
#include "nsIWebShell.h"
#include "pratom.h"
#include "nsIComponentManager.h"
#include "nsAppCores.h"
#include "nsAppCoresCIDs.h"
#include "nsAppShellCIDs.h"
#include "nsAppCoresManager.h"
#include "nsIAppShellService.h"
#include "nsIServiceManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIScriptContextOwner.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMWindow.h"
#include "nsIWebShellWindow.h"
#include "nsIDOMHTMLInputElement.h"
#include "plstr.h"
#include "prmem.h"
#include <ctype.h>
class nsIDOMnsStringArray;
// Globals - how many K are we wasting by putting these in every file?
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIProfileCoreIID, NS_IDOMPROFILECORE_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, nsIDOMDocument::GetIID());
static NS_DEFINE_IID(kIDocumentIID, nsIDocument::GetIID());
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_IID(kIProfileIID, NS_IPROFILE_IID);
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
#ifdef NS_DEBUG
static PRBool firstTime = PR_TRUE;
#endif
//----------------------------------------------------------------------------------------
nsProfileCore::nsProfileCore()
//----------------------------------------------------------------------------------------
: mProfile(nsnull)
{
printf("Created nsProfileCore\n");
mScriptObject = nsnull;
IncInstanceCount();
NS_INIT_REFCNT();
}
//----------------------------------------------------------------------------------------
nsProfileCore::~nsProfileCore()
//----------------------------------------------------------------------------------------
{
//NS_IF_RELEASE(mWindow);
DecInstanceCount();
}
//NS_IMPL_ADDREF(nsProfileCore)
//NS_IMPL_RELEASE(nsProfileCore)
// Is this needed ?
NS_IMPL_ISUPPORTS_INHERITED(nsProfileCore, nsBaseAppCore, nsIDOMProfileCore)
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsProfileCore::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
//----------------------------------------------------------------------------------------
{
NS_PRECONDITION(nsnull != aScriptObject, "null arg");
nsresult res = NS_OK;
if (nsnull == mScriptObject)
{
res = NS_NewScriptProfileCore(aContext,
(nsISupports *)(nsIDOMProfileCore*)this,
nsnull,
&mScriptObject);
}
*aScriptObject = mScriptObject;
return res;
}
//----------------------------------------------------------------------------------------
nsresult nsProfileCore::InitializeProfileManager()
//----------------------------------------------------------------------------------------
{
nsIProfile* Profile;
nsresult rv = nsServiceManager::GetService(kProfileCID, kIProfileIID, (nsISupports**)&Profile);
if (NS_FAILED(rv))
return rv;
if (!Profile)
return NS_ERROR_FAILURE;
if (Profile)
nsServiceManager::ReleaseService(kProfileCID, Profile);
if (NS_FAILED(rv))
return rv;
mProfile = Profile;
return NS_OK;
} // nsProfileCore::InitializeProfileManager
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsProfileCore::Init(const nsString& aId)
//----------------------------------------------------------------------------------------
{
nsresult rv = nsBaseAppCore::Init(aId);
if (NS_FAILED(rv))
return rv;
rv = InitializeProfileManager();
if (NS_FAILED(rv))
return rv;
return NS_OK;
} // nsProfileCore::Init
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsProfileCore::CreateNewProfile(const nsString& aData)
// Start loading of a new Profile panel.
//----------------------------------------------------------------------------------------
{
//nsFileSpec currProfileDirSpec;
printf ("Entered Create Profile Routine");
//printf("value 1 = %s", aData->StringAt(0));
//currProfileDirSpec = "c:\loser";
mProfile->CreateNewProfile(aData.ToNewCString());
return NS_OK;
}

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

@ -0,0 +1,150 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsProfileCorePrivate_h___
#define nsProfileCorePrivate_h___
//#include "nsAppCores.h"
#include "nscore.h"
#include "nsISupports.h"
#include "nsIDOMProfileCore.h"
#include "nsBaseAppCore.h"
#include "prtypes.h"
class nsIBrowserWindow;
class nsIWebShell;
class nsIScriptContext;
class nsIDOMWindow;
class nsIProfile;
class nsIDOMNode;
class nsIDOMHTMLInputElement;
class nsString;
class nsIDOMnsStringArray;
//========================================================================================
class nsProfileCore
//========================================================================================
: public nsBaseAppCore
, public nsIDOMProfileCore
{
public:
nsProfileCore();
virtual ~nsProfileCore();
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD Init(const nsString& aId);
NS_IMETHOD GetId(nsString& aId)
{
return nsBaseAppCore::GetId(aId);
}
NS_IMETHOD SetDocumentCharset(const nsString& aCharset)
{
return nsBaseAppCore::SetDocumentCharset(aCharset);
}
NS_IMETHOD CreateNewProfile(const nsString& aData);
protected:
nsresult InitializeProfileManager();
protected:
nsIProfile* mProfile;
};
#endif // nsProfileCore_h___

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

@ -0,0 +1,204 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsProfileCoreFactory.h"
#include "nsAppCores.h"
#include "nsProfileCore.h"
#include "pratom.h"
#include "nsISupportsUtils.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
//----------------------------------------------------------------------------------------
nsProfileCoreFactory::nsProfileCoreFactory()
//----------------------------------------------------------------------------------------
{
NS_INIT_REFCNT();
IncInstanceCount();
}
//----------------------------------------------------------------------------------------
nsProfileCoreFactory::~nsProfileCoreFactory()
//----------------------------------------------------------------------------------------
{
DecInstanceCount();
}
NS_IMPL_ADDREF(nsProfileCoreFactory)
NS_IMPL_RELEASE(nsProfileCoreFactory)
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsProfileCoreFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
//----------------------------------------------------------------------------------------
{
if (aInstancePtr == NULL)
return NS_ERROR_NULL_POINTER;
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kISupportsIID) )
*aInstancePtr = (void*) this;
else if ( aIID.Equals(kIFactoryIID) )
*aInstancePtr = (void*) this;
if (aInstancePtr == NULL)
return NS_ERROR_NO_INTERFACE;
AddRef();
return NS_OK;
} // nsProfileCoreFactory::QueryInterface
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsProfileCoreFactory::CreateInstance(
nsISupports* aOuter,
REFNSIID aIID,
void **aResult)
//----------------------------------------------------------------------------------------
{
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
*aResult = NULL;
nsProfileCore* inst = new nsProfileCore();
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;
nsresult result = inst->QueryInterface(aIID, aResult);
if (result != NS_OK)
delete inst;
return result;
} // nsProfileCoreFactory::CreateInstance
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsProfileCoreFactory::LockFactory(PRBool aLock)
//----------------------------------------------------------------------------------------
{
if (aLock)
IncLockCount();
else
DecLockCount();
return NS_OK;
} // nsProfileCoreFactory::LockFactory

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