Changeset 361 for trunk/src/helpers/apps.c
- Timestamp:
- Mar 13, 2008, 1:29:15 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/apps.c
r297 r361 15 15 16 16 /* 17 * Copyright (C) 1997-200 5Ulrich Mller.17 * Copyright (C) 1997-2008 Ulrich Mller. 18 18 * This file is part of the "XWorkplace helpers" source package. 19 19 * This is free software; you can redistribute it and/or modify … … 2002 2002 *@@added V0.9.20 (2002-08-10) [umoeller] 2003 2003 *@@changed V1.0.0 (2002-08-21) [umoeller]: changed prototype to return browser 2004 */ 2004 *@@changed WarpIN V1.0.17 (2008-03-08) [pr]: rewritten to add IAIUTIL settings 2005 */ 2006 2007 typedef struct _URLPROTOAPP { 2008 PCSZ pcszProtocol; 2009 PCSZ pcszKeyExe; 2010 PCSZ pcszKeyParam; 2011 PCSZ pcszKeyDir; 2012 } URLPROTOAPP; 2005 2013 2006 2014 APIRET appOpenURL(PCSZ pcszURL, // in: URL to open … … 2009 2017 { 2010 2018 APIRET arc = ERROR_NO_DATA; 2011 2012 CHAR szStartupDir[CCHMAXPATH];2013 2019 XSTRING strParameters; 2020 PCSZ pcszApp = "WPURLDEFAULTSETTINGS", pcszKeyExe, pcszKeyParam, pcszKeyDir; 2021 ULONG i; 2022 URLPROTOAPP urlProtoApps[] = { 2023 { "", "DefaultBrowserExe", "DefaultParameters", "DefaultWorkingDir" }, 2024 { "mailto:", "DefaultMailExe", "DefaultMailParameters", "DefaultMailWorkingDir" }, 2025 { "news:", "DefaultNewsExe", "DefaultNewsParameters", "DefaultNewsWorkingDir" }, 2026 { "ftp:", "DefaultFTPExe", "DefaultFTPParameters", "DefaultFTPWorkingDir" }, 2027 { "irc:", "DefaultIRCExe", "DefaultIRCParameters", "DefaultIRCWorkingDir" } 2028 }; 2014 2029 2015 2030 if ( (!pcszURL) … … 2020 2035 2021 2036 xstrInit(&strParameters, 0); 2022 2023 if (PrfQueryProfileString(HINI_USER, 2024 "WPURLDEFAULTSETTINGS", 2025 "DefaultBrowserExe", 2026 "NETSCAPE.EXE", 2027 pszAppStarted, 2028 cbAppStarted)) 2029 { 2030 PSZ pszDefParams; 2031 HAPP happ; 2032 2033 if (pszDefParams = prfhQueryProfileData(HINI_USER, 2034 "WPURLDEFAULTSETTINGS", 2035 "DefaultParameters", 2036 NULL)) 2037 { 2038 xstrcpy(&strParameters, pszDefParams, 0); 2039 xstrcatc(&strParameters, ' '); 2040 free(pszDefParams); 2041 } 2042 2043 xstrcat(&strParameters, pcszURL, 0); 2044 2045 PrfQueryProfileString(HINI_USER, 2046 "WPURLDEFAULTSETTINGS", 2047 "DefaultWorkingDir", 2048 "", 2049 szStartupDir, 2050 sizeof(szStartupDir)); 2051 2052 arc = appQuickStartApp(pszAppStarted, 2053 PROG_DEFAULT, 2054 strParameters.psz, 2055 szStartupDir, 2056 &happ, 2057 NULL); // don't wait 2037 for (i = sizeof(urlProtoApps) / sizeof(urlProtoApps[0]); i; i--) 2038 { 2039 if (!strnicmp(pcszURL, 2040 urlProtoApps[i - 1].pcszProtocol, 2041 strlen(urlProtoApps[i - 1].pcszProtocol))) 2042 { 2043 if (PrfQueryProfileString(HINI_USER, 2044 (PSZ) pcszApp, 2045 (PSZ) urlProtoApps[i - 1].pcszKeyExe, 2046 NULL, 2047 pszAppStarted, 2048 cbAppStarted)) 2049 { 2050 PSZ pszDefParams; 2051 CHAR szStartupDir[CCHMAXPATH]; 2052 HAPP happ; 2053 2054 if (pszDefParams = prfhQueryProfileData(HINI_USER, 2055 pcszApp, 2056 urlProtoApps[i - 1].pcszKeyParam, 2057 NULL)) 2058 { 2059 xstrcpy(&strParameters, pszDefParams, 0); 2060 xstrcatc(&strParameters, ' '); 2061 free(pszDefParams); 2062 } 2063 2064 xstrcat(&strParameters, pcszURL, 0); 2065 PrfQueryProfileString(HINI_USER, 2066 (PSZ) pcszApp, 2067 (PSZ) urlProtoApps[i - 1].pcszKeyDir, 2068 "", 2069 szStartupDir, 2070 sizeof(szStartupDir)); 2071 arc = appQuickStartApp(pszAppStarted, 2072 PROG_DEFAULT, 2073 strParameters.psz, 2074 szStartupDir, 2075 &happ, 2076 NULL); // don't wait 2077 break; 2078 } 2079 } 2058 2080 } 2059 2081 2060 2082 xstrClear(&strParameters); 2061 2062 2083 return arc; 2063 2084 }
Note:
See TracChangeset
for help on using the changeset viewer.