зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 149126: Mail Client doesn't work correctly with Open Office with rpm builds
patch by joey.shen@sun.com r=blizzard@mozilla.org sr=dmose@mozilla.org a=asa@mozilla.org
This commit is contained in:
Родитель
e7bc557c1f
Коммит
03420056bc
|
@ -498,6 +498,38 @@ XRemoteService::BuildResponse(const char *aError, const char *aMessage)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XRemoteService::FindRestInList(nsCString &aString, nsCString &retString,
|
||||||
|
PRUint32 *aIndexRet)
|
||||||
|
{
|
||||||
|
// init our return
|
||||||
|
*aIndexRet = 0;
|
||||||
|
nsCString tempString;
|
||||||
|
PRInt32 strIndex;
|
||||||
|
// find out if there's a comma from the start of the string
|
||||||
|
strIndex = aString.FindChar(',');
|
||||||
|
|
||||||
|
// give up now if you can
|
||||||
|
if (strIndex == kNotFound)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// cut the string down to the first ,
|
||||||
|
tempString = Substring(aString, strIndex+1, aString.Length());
|
||||||
|
|
||||||
|
// strip off leading + trailing whitespace
|
||||||
|
tempString.Trim(" ", PR_TRUE, PR_TRUE);
|
||||||
|
|
||||||
|
// see if we've reduced it to nothing
|
||||||
|
if (tempString.IsEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
*aIndexRet = strIndex;
|
||||||
|
|
||||||
|
// otherwise, return it as a new C string
|
||||||
|
retString = tempString;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XRemoteService::FindLastInList(nsCString &aString, nsCString &retString,
|
XRemoteService::FindLastInList(nsCString &aString, nsCString &retString,
|
||||||
PRUint32 *aIndexRet)
|
PRUint32 *aIndexRet)
|
||||||
|
@ -589,6 +621,15 @@ XRemoteService::GetMailLocation(char **_retval)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
XRemoteService::GetComposeLocation(const char **_retval)
|
||||||
|
{
|
||||||
|
// get the Compose chrome URL
|
||||||
|
*_retval = "chrome://messenger/content/messengercompose/messengercompose.xul";
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
XRemoteService::OpenURL(nsCString &aArgument,
|
XRemoteService::OpenURL(nsCString &aArgument,
|
||||||
nsIDOMWindowInternal *aParent,
|
nsIDOMWindowInternal *aParent,
|
||||||
|
@ -810,6 +851,22 @@ XRemoteService::XfeDoCommand(nsCString &aArgument,
|
||||||
nsIDOMWindowInternal *aParent)
|
nsIDOMWindowInternal *aParent)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
// see if there are any arguments on the end
|
||||||
|
nsCString restArgument;
|
||||||
|
PRUint32 index;
|
||||||
|
FindRestInList(aArgument, restArgument, &index);
|
||||||
|
|
||||||
|
if (!restArgument.IsEmpty())
|
||||||
|
aArgument.Truncate(index);
|
||||||
|
nsCOMPtr<nsISupportsString> arg;
|
||||||
|
arg = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
// pass the second argument as parameter
|
||||||
|
arg->SetData(NS_ConvertUTF8toUCS2(restArgument));
|
||||||
|
|
||||||
// someone requested opening mail/news
|
// someone requested opening mail/news
|
||||||
if (aArgument.EqualsIgnoreCase("openinbox")) {
|
if (aArgument.EqualsIgnoreCase("openinbox")) {
|
||||||
|
@ -838,7 +895,7 @@ XRemoteService::XfeDoCommand(nsCString &aArgument,
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||||
rv = OpenChromeWindow(0, mailLocation, "chrome,all,dialog=no",
|
rv = OpenChromeWindow(0, mailLocation, "chrome,all,dialog=no",
|
||||||
nsnull, getter_AddRefs(newWindow));
|
arg, getter_AddRefs(newWindow));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,13 +908,23 @@ XRemoteService::XfeDoCommand(nsCString &aArgument,
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||||
rv = OpenChromeWindow(0, browserLocation, "chrome,all,dialog=no",
|
rv = OpenChromeWindow(0, browserLocation, "chrome,all,dialog=no",
|
||||||
nsnull, getter_AddRefs(newWindow));
|
arg, getter_AddRefs(newWindow));
|
||||||
}
|
}
|
||||||
|
|
||||||
// open a new compose window
|
// open a new compose window
|
||||||
else if (aArgument.EqualsIgnoreCase("composemessage")) {
|
else if (aArgument.EqualsIgnoreCase("composemessage")) {
|
||||||
nsCString tempString("mailto:");
|
/*
|
||||||
rv = OpenURL(tempString, nsnull, PR_FALSE);
|
* Here we change to OpenChromeWindow instead of OpenURL so as to
|
||||||
|
* pass argument values to the compose window, especially attachments
|
||||||
|
*/
|
||||||
|
const char * composeLocation;
|
||||||
|
rv = GetComposeLocation(&composeLocation);
|
||||||
|
if (rv != NS_OK)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||||
|
rv = OpenChromeWindow(0, composeLocation, "chrome,all,dialog=no",
|
||||||
|
arg, getter_AddRefs(newWindow));
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -52,6 +52,10 @@ class XRemoteService : public nsIXRemoteService {
|
||||||
|
|
||||||
// find the last argument in an argument string
|
// find the last argument in an argument string
|
||||||
void FindLastInList(nsCString &aString, nsCString &retString,
|
void FindLastInList(nsCString &aString, nsCString &retString,
|
||||||
|
PRUint32 *aIndexRet);
|
||||||
|
|
||||||
|
// find the second argument through the last argument in the string
|
||||||
|
void FindRestInList(nsCString &aString, nsCString &retString,
|
||||||
PRUint32 *aIndexRet);
|
PRUint32 *aIndexRet);
|
||||||
|
|
||||||
// short cut for opening chrome windows
|
// short cut for opening chrome windows
|
||||||
|
@ -64,6 +68,7 @@ class XRemoteService : public nsIXRemoteService {
|
||||||
// get the primary browser chrome location
|
// get the primary browser chrome location
|
||||||
nsresult GetBrowserLocation(char **_retval);
|
nsresult GetBrowserLocation(char **_retval);
|
||||||
nsresult GetMailLocation(char **_retval);
|
nsresult GetMailLocation(char **_retval);
|
||||||
|
nsresult GetComposeLocation(const char **_retval);
|
||||||
|
|
||||||
// remote command handlers
|
// remote command handlers
|
||||||
nsresult OpenURL(nsCString &aArgument,
|
nsresult OpenURL(nsCString &aArgument,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче