зеркало из https://github.com/mozilla/pjs.git
Open a separate 3 pane Mail window using Javascrip
This commit is contained in:
Родитель
886796c607
Коммит
edc19d406c
|
@ -26,6 +26,7 @@ class nsIDOMMsgAppCore : public nsIDOMBaseAppCore {
|
|||
|
||||
/* void GetNewMail (); */
|
||||
NS_IMETHOD GetNewMail() = 0;
|
||||
NS_IMETHOD Open3PaneWindow()=0;
|
||||
};
|
||||
|
||||
#endif /* __gen_nsIDOMMsgAppCore_h__ */
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
interface nsIDOMMsgAppCore : nsIDOMBaseAppCore {
|
||||
|
||||
void GetNewMail();
|
||||
void Open3PaneWindow();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
|
||||
|
||||
<script LANGUAGE="JavaScript">
|
||||
<!--
|
||||
|
||||
function OpenMailWindow()
|
||||
{
|
||||
var appCore = AppCoresManager.Find("MailCore");
|
||||
if (appCore==null) {
|
||||
appCore = new MailCore();
|
||||
if (appCore != null) {
|
||||
appCore.Init("MailCore");
|
||||
appCore.SetWindow(window);
|
||||
appCore.Open3PaneWindow();
|
||||
}
|
||||
} else {
|
||||
appCore.Open3PaneWindow();
|
||||
}
|
||||
}
|
||||
|
||||
// End -->
|
||||
</script>
|
||||
|
||||
|
||||
<title>Mozilla Messenger</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<style type="text/css">
|
||||
/* This style sheet should be in a seperate file */
|
||||
|
||||
BODY,TD {
|
||||
font-family: Sans-Serif;
|
||||
background-color: #C0C0C0;
|
||||
}
|
||||
|
||||
BODY,TD,INPUT {
|
||||
font-size: 9pt;
|
||||
}
|
||||
BODY {
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<iframe src="msgbar.xml" name="messenger.toolbar" width="100%" height="56" >
|
||||
|
||||
<iframe src="frames.html" name="messenger.3pane" width="100%" height="500" >
|
||||
|
||||
<iframe src="status.html" name="messenger.status" width="100%" height="34" >
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -163,6 +163,33 @@ MsgAppCoreGetNewMail(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Native method Open3PaneWindow
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
MsgAppCoreOpen3PaneWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMMailCore *nativeThis = (nsIDOMMailCore*)JS_GetPrivate(cx, obj);
|
||||
// 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->Open3PaneWindow()) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Open3PaneWindow don't have argument");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
// this was in the old MailCore
|
||||
#if 0
|
||||
//
|
||||
|
@ -319,6 +346,7 @@ static JSFunctionSpec MsgAppCoreMethods[] =
|
|||
{
|
||||
// don't have old MailCore methods
|
||||
{"GetNewMail", MsgAppCoreGetNewMail, 0},
|
||||
{"Open3PaneWindow", MsgAppCoreOpen3PaneWindow, 0},
|
||||
#if 0
|
||||
{"SendMail", MsgAppCoreSendMail, 3},
|
||||
{"MailCompleteCallback", MsgAppCoreMailCompleteCallback, 1},
|
||||
|
@ -476,3 +504,4 @@ extern "C" NS_DOM nsresult NS_NewScriptMsgAppCore(nsIScriptContext *aContext, ns
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ public:
|
|||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
// nsIMsgAppCore
|
||||
NS_IMETHOD Open3PaneWindow();
|
||||
NS_IMETHOD GetNewMail();
|
||||
NS_IMETHOD SetWindow(nsIDOMWindow* aWin);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
nsString mId;
|
||||
|
@ -167,6 +167,39 @@ nsMsgAppCore::GetId(nsString& aId)
|
|||
//
|
||||
// nsIMsgAppCore
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsMsgAppCore::Open3PaneWindow()
|
||||
{
|
||||
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
|
||||
|
||||
nsIAppShellService* appShell;
|
||||
char * urlstr=nsnull;
|
||||
nsresult rv;
|
||||
nsString controllerCID;
|
||||
|
||||
urlstr = "resource:/res/samples/messenger.html";
|
||||
rv = nsServiceManager::GetService(kAppShellServiceCID,
|
||||
kIAppShellServiceIID,
|
||||
(nsISupports**)&appShell);
|
||||
nsIURL* url;
|
||||
nsIWidget* newWindow;
|
||||
|
||||
rv = NS_NewURL(&url, urlstr);
|
||||
if (NS_FAILED(rv)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
controllerCID = "6B75BB61-BD41-11d2-9D31-00805F8ADDDE";
|
||||
appShell->CreateTopLevelWindow(url, controllerCID, newWindow, nsnull);
|
||||
done:
|
||||
NS_RELEASE(url);
|
||||
if (nsnull != appShell) {
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAppCore::GetNewMail()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче