- Timestamp:
- Sep 15, 2006, 8:27:11 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
psi/trunk/src/common.cpp
r48 r50 981 981 } 982 982 983 #ifdef Q_WS_PM 984 static QString getBrowserSetting (PCSZ key) 985 { 986 static const PSZ app = "WPURLDEFAULTSETTINGS"; 987 988 QString value; 989 ULONG keyLen = 0; 990 991 if ( PrfQueryProfileSize( HINI_USERPROFILE, app, key, &keyLen ) && keyLen ) { 992 char *buf = new char [keyLen]; 993 ULONG realLen = 994 PrfQueryProfileString( HINI_USERPROFILE, app, key, NULL, buf, keyLen ); 995 if (realLen) { 996 realLen --; // excude zero terminator 997 buf[realLen] = 0; 998 value = QString::fromLocal8Bit(buf); 999 } 1000 delete[] buf; 1001 } 1002 1003 return value; 1004 } 1005 #endif 1006 983 1007 void openURL(const QString &url) 984 1008 { … … 1000 1024 #endif 1001 1025 #ifdef Q_WS_PM 1002 /// @todo (dmik) use HINI_USER_PROFILE\WPURLDEFAULTSETTINGS\DefaultBrowserExe 1026 if(option.browser == 0) 1027 useCustom = FALSE; 1003 1028 #endif 1004 1029 #ifdef Q_WS_X11 … … 1013 1038 bool isMail = FALSE; 1014 1039 QString s = url; 1015 if(url.left(7) == "mailto:") { 1040 if(url.left(7).lower() == "mailto:") { 1041 #ifdef Q_WS_PM 1042 // mozilla/thunderbird doesn't understand e-mails w/o 'mailto:' 1043 #else 1016 1044 s.remove(0, 7); 1045 #endif 1017 1046 isMail = TRUE; 1018 1047 } … … 1049 1078 #endif 1050 1079 #ifdef Q_WS_PM 1051 /// @todo (dmik) use HINI_USER_PROFILE\WPURLDEFAULTSETTINGS\DefaultBrowserExe 1080 QString exe, params, workDir; 1081 1082 if (url.left(7).lower() == "mailto:") { 1083 exe = getBrowserSetting("DefaultMailExe"); 1084 params = getBrowserSetting("DefaultMailParameters"); 1085 workDir = getBrowserSetting("DefaultMailWorkingDir"); 1086 } else if (url.left(5).lower() == "news:") { 1087 exe = getBrowserSetting("DefaultNewsExe"); 1088 params = getBrowserSetting("DefaultNewsParameters"); 1089 workDir = getBrowserSetting("DefaultNewsWorkingDir"); 1090 } else if (url.left(4).lower() == "ftp:") { 1091 exe = getBrowserSetting("DefaultFTPExe"); 1092 params = getBrowserSetting("DefaultFTPParameters"); 1093 workDir = getBrowserSetting("DefaultFTPWorkingDir"); 1094 } else if (url.left(4).lower() == "irc:") { 1095 exe = getBrowserSetting("DefaultIRCExe"); 1096 params = getBrowserSetting("DefaultIRCParameters"); 1097 workDir = getBrowserSetting("DefaultIRCWorkingDir"); 1098 } 1099 // if the specific app is not found, fallback to the general broswer 1100 if (exe.isEmpty()) { 1101 exe = getBrowserSetting("DefaultBrowserExe"); 1102 params = getBrowserSetting("DefaultParameters"); 1103 workDir = getBrowserSetting("DefaultWorkingDir"); 1104 } 1105 1106 bool success = false; 1107 1108 if (!exe.isEmpty()) { 1109 QStringList args; 1110 args += exe; 1111 if (!params.isEmpty()) args += params; 1112 args += url; 1113 QProcess cmd(args); 1114 if (!workDir.isEmpty()) cmd.setWorkingDirectory(workDir); 1115 success = cmd.start(); 1116 } 1117 1118 if (!success) 1119 QMessageBox::critical(0, CAP(QObject::tr("URL error")), 1120 QObject::tr("Unable to open the URL. Ensure that you have a web " 1121 "browser installed.")); 1052 1122 #endif 1053 1123 #ifdef Q_WS_X11 … … 1113 1183 { 1114 1184 #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_PM) 1115 /// @todo (dmik) test it1116 1185 time_t x; 1117 1186 time(&x);
Note:
See TracChangeset
for help on using the changeset viewer.