Index: xap_Win32AppImpl.cpp =================================================================== RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32AppImpl.cpp,v retrieving revision 1.3 diff -u -r1.3 xap_Win32AppImpl.cpp --- xap_Win32AppImpl.cpp 7 Feb 2004 14:53:52 -0000 1.3 +++ xap_Win32AppImpl.cpp 20 Apr 2004 04:22:55 -0000 @@ -20,6 +20,7 @@ #include +#include #include "xap_Win32AppImpl.h" #include "ut_string_class.h" @@ -34,40 +35,94 @@ UT_String sURL = szURL; - // strip file:///\ from URL, the extra forward-slash back-slash is passed in from "View as Web Page" - if ( "file:///\\" == sURL.substr(0,9) ) + // If this is a file:// URL, strip off file:// and make it backslashed + if (sURL.substr(0, 7) == "file://") { - sURL = sURL.substr(9, sURL.size() - 9); + sURL = sURL.substr(7, sURL.size() - 7); + + // View as WebPage likes to throw in an extra /\ just for fun, strip it off + if (sURL.substr(0, 2) == "/\\") + sURL = sURL.substr(2, sURL.size() - 2); + + // Enclose in double-quotes, incase there's a space in the path + if ((sURL.substr(0, 1) != "\"") && (sURL.substr(sURL.size() -1, 1) != "\"")) + sURL = "\"" + sURL + "\""; + + // Convert all forwardslashes to backslashes + for (unsigned int i=0; igetLastFocussedFrame(); UT_return_val_if_fail(pFrame, false); XAP_Win32FrameImpl *pFImp = (XAP_Win32FrameImpl *) pFrame->getFrameImpl(); UT_return_val_if_fail(pFImp, false); - - + int res = (int) ShellExecute(pFImp->getTopLevelWindow() /*(HWND)*/, - "open", sURL.c_str(), NULL, NULL, SW_SHOWNORMAL); + "open", sBrowser.c_str(), sParams.c_str(), NULL, SW_SHOW ); // TODO: localized error messages // added more specific error messages as documented in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp - - if (res <= 32) // show error message if failed to launch browser to display URL + if (res <= 32) { UT_String errMsg; switch (res) { - case 2: + case ERROR_FILE_NOT_FOUND: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res); @@ -77,7 +132,7 @@ } break; - case 3: + case ERROR_PATH_NOT_FOUND: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res); @@ -87,7 +142,7 @@ } break; - case 5: + case SE_ERR_ACCESSDENIED: { errMsg = "Error ("; errMsg += UT_String_sprintf("%d", res);