From d931210577e523fe0c3d7843ddbf700d9fb9c4f1 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Sat, 12 Jul 2003 04:12:14 +0000 Subject: [PATCH] Ugly thunderbird hack. Has no effect on seamonkey builds. When launching the app via Launch Task (which is the case when starting up for the first time), check to see if the cmd line service has any arguments (such as mailto urls). If so pass these arguments into OpenWindow instead of using the handler's default arguments. This fixes the problem where clicking on a mailto url in a browser when thunderbird was NOT already running, caused a blank compose window where the mailto url was ignored. --- xpfe/appshell/src/nsAppShellService.cpp | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index 0f014da9ee31..d8b5d0ad934f 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -1114,10 +1114,34 @@ nsAppShellService::LaunchTask(const char *aParam, PRInt32 height, PRInt32 width, PRBool handlesArgs = PR_FALSE; rv = handler->GetHandlesArgs(&handlesArgs); if (handlesArgs) { +#ifndef MOZ_THUNDERBIRD nsXPIDLString defaultArgs; rv = handler->GetDefaultArgs(getter_Copies(defaultArgs)); if (NS_FAILED(rv)) return rv; rv = OpenWindow(chromeUrlForTask, defaultArgs, SIZE_TO_CONTENT, SIZE_TO_CONTENT); +#else + // XXX horibble thunderbird hack. Don't pass in the default args if the cmd line service + // says we have real arguments! Use those instead. + nsXPIDLCString args; + nsXPIDLCString cmdLineArgument; // -mail, -compose, etc. + rv = handler->GetCommandLineArgument(getter_Copies(cmdLineArgument)); + if (NS_SUCCEEDED(rv)) { + rv = cmdLine->GetCmdLineValue(cmdLineArgument, getter_Copies(args)); + if (NS_SUCCEEDED(rv) && args.get()) { + nsAutoString cmdArgs; cmdArgs.AssignWithConversion(args); + rv = OpenWindow(chromeUrlForTask, cmdArgs, height, width); + } + } + + // any failure case, do what we used to do: + if (NS_FAILED(rv)) { + nsXPIDLString defaultArgs; + rv = handler->GetDefaultArgs(getter_Copies(defaultArgs)); + if (NS_FAILED(rv)) return rv; + rv = OpenWindow(chromeUrlForTask, defaultArgs, SIZE_TO_CONTENT, SIZE_TO_CONTENT); + } +#endif + } else { rv = OpenWindow(chromeUrlForTask, nsString(), width, height); @@ -1233,10 +1257,11 @@ nsAppShellService::Ensure1Window(nsICmdLineService *aCmdLineService) #ifdef MOZ_THUNDERBIRD PRBool windowOpened = PR_FALSE; + rv = LaunchTask(NULL, height, width, &windowOpened); + if (NS_FAILED(rv) || !windowOpened) rv = LaunchTask("mail", height, width, &windowOpened); - #else rv = OpenBrowserWindow(height, width); #endif