Changeset 361
- Timestamp:
- Mar 13, 2008, 1:29:15 AM (17 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/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 … … 2083 2083 *@@added V0.9.20 (2002-08-10) [umoeller] 2084 2084 *@@changed V1.0.0 (2002-08-21) [umoeller]: changed prototype to return browser 2085 */ 2085 *@@changed WarpIN V1.0.17 (2008-03-08) [pr]: rewritten to add IAIUTIL settings 2086 */ 2087 2088 typedef struct _URLPROTOAPP { 2089 PCSZ pcszProtocol; 2090 PCSZ pcszKeyExe; 2091 PCSZ pcszKeyParam; 2092 PCSZ pcszKeyDir; 2093 } URLPROTOAPP; 2086 2094 2087 2095 APIRET appOpenURL(PCSZ pcszURL, // in: URL to open … … 2090 2098 { 2091 2099 APIRET arc = ERROR_NO_DATA; 2092 2093 CHAR szStartupDir[CCHMAXPATH];2094 2100 XSTRING strParameters; 2101 PCSZ pcszApp = "WPURLDEFAULTSETTINGS", pcszKeyExe, pcszKeyParam, pcszKeyDir; 2102 ULONG i; 2103 URLPROTOAPP urlProtoApps[] = { 2104 { "", "DefaultBrowserExe", "DefaultParameters", "DefaultWorkingDir" }, 2105 { "mailto:", "DefaultMailExe", "DefaultMailParameters", "DefaultMailWorkingDir" }, 2106 { "news:", "DefaultNewsExe", "DefaultNewsParameters", "DefaultNewsWorkingDir" }, 2107 { "ftp:", "DefaultFTPExe", "DefaultFTPParameters", "DefaultFTPWorkingDir" }, 2108 { "irc:", "DefaultIRCExe", "DefaultIRCParameters", "DefaultIRCWorkingDir" } 2109 }; 2095 2110 2096 2111 if ( (!pcszURL) … … 2101 2116 2102 2117 xstrInit(&strParameters, 0); 2103 2104 if (PrfQueryProfileString(HINI_USER, 2105 "WPURLDEFAULTSETTINGS", 2106 "DefaultBrowserExe", 2107 "NETSCAPE.EXE", 2108 pszAppStarted, 2109 cbAppStarted)) 2110 { 2111 PSZ pszDefParams; 2112 HAPP happ; 2113 2114 if (pszDefParams = prfhQueryProfileData(HINI_USER, 2115 "WPURLDEFAULTSETTINGS", 2116 "DefaultParameters", 2117 NULL)) 2118 { 2119 xstrcpy(&strParameters, pszDefParams, 0); 2120 xstrcatc(&strParameters, ' '); 2121 free(pszDefParams); 2122 } 2123 2124 xstrcat(&strParameters, pcszURL, 0); 2125 2126 PrfQueryProfileString(HINI_USER, 2127 "WPURLDEFAULTSETTINGS", 2128 "DefaultWorkingDir", 2129 "", 2130 szStartupDir, 2131 sizeof(szStartupDir)); 2132 2133 arc = appQuickStartApp(pszAppStarted, 2134 PROG_DEFAULT, 2135 strParameters.psz, 2136 szStartupDir, 2137 &happ, 2138 NULL); // don't wait 2118 for (i = sizeof(urlProtoApps) / sizeof(urlProtoApps[0]); i; i--) 2119 { 2120 if (!strnicmp(pcszURL, 2121 urlProtoApps[i - 1].pcszProtocol, 2122 strlen(urlProtoApps[i - 1].pcszProtocol))) 2123 { 2124 if (PrfQueryProfileString(HINI_USER, 2125 (PSZ) pcszApp, 2126 (PSZ) urlProtoApps[i - 1].pcszKeyExe, 2127 NULL, 2128 pszAppStarted, 2129 cbAppStarted)) 2130 { 2131 PSZ pszDefParams; 2132 CHAR szStartupDir[CCHMAXPATH]; 2133 HAPP happ; 2134 2135 if (pszDefParams = prfhQueryProfileData(HINI_USER, 2136 pcszApp, 2137 urlProtoApps[i - 1].pcszKeyParam, 2138 NULL)) 2139 { 2140 xstrcpy(&strParameters, pszDefParams, 0); 2141 xstrcatc(&strParameters, ' '); 2142 free(pszDefParams); 2143 } 2144 2145 xstrcat(&strParameters, pcszURL, 0); 2146 PrfQueryProfileString(HINI_USER, 2147 (PSZ) pcszApp, 2148 (PSZ) urlProtoApps[i - 1].pcszKeyDir, 2149 "", 2150 szStartupDir, 2151 sizeof(szStartupDir)); 2152 arc = appQuickStartApp(pszAppStarted, 2153 PROG_DEFAULT, 2154 strParameters.psz, 2155 szStartupDir, 2156 &happ, 2157 NULL); // don't wait 2158 break; 2159 } 2160 } 2139 2161 } 2140 2162 2141 2163 xstrClear(&strParameters); 2142 2143 2164 return arc; 2144 2165 } -
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.