Changeset 361 for branches/branch-1-0/src/helpers/apps.c
- Timestamp:
- Mar 13, 2008, 1:29:15 AM (17 years ago)
- File:
-
- 1 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 }
Note:
See TracChangeset
for help on using the changeset viewer.