| 1056 | } |
| 1057 | |
| 1058 | bool FileSystemManager::launchFile(SHELLEXECUTEINFO sei, QString filePath) { |
| 1059 | |
| 1060 | QString errMsg; |
| 1061 | |
| 1062 | if(!ShellExecuteEx(&sei)) |
| 1063 | { |
| 1064 | // for all intents and purposes, we will return true after an |
| 1065 | // async execution |
| 1066 | |
| 1067 | int rcVal = (int) sei.hInstApp; |
| 1068 | |
| 1069 | errMsg = QT_TR_NOOP("BumpTop failed to launch file: %1.\n\n").arg(filePath); |
| 1070 | |
| 1071 | // Select the appropriate Message |
| 1072 | switch (rcVal) |
| 1073 | { |
| 1074 | case 0: errMsg.append("Out of Memory or Resources."); break; |
| 1075 | case ERROR_BAD_FORMAT: errMsg.append("The .exe file is invalid (non-Microsoft Win32 .exe or error in .exe image). "); break; |
| 1076 | case SE_ERR_ACCESSDENIED: errMsg.append("The operating system denied access to the specified file or link target. "); break; |
| 1077 | case SE_ERR_ASSOCINCOMPLETE: errMsg.append("The file name association is incomplete or invalid. "); break; |
| 1078 | case SE_ERR_DDEBUSY: errMsg.append("The Dynamic Data Exchange (DDE) transaction could not be completed because other DDE transactions were being processed. "); break; |
| 1079 | case SE_ERR_DDEFAIL: errMsg.append("The DDE transaction failed. "); break; |
| 1080 | case SE_ERR_DDETIMEOUT: errMsg.append("The DDE transaction could not be completed because the request timed out. "); break; |
| 1081 | case SE_ERR_DLLNOTFOUND: errMsg.append("The specified DLL was not found. "); break; |
| 1082 | case SE_ERR_FNF: errMsg.append("The specified file was not found. "); break; |
| 1083 | case SE_ERR_NOASSOC: errMsg.append("There is no application associated with the given file name extension. "); break; |
| 1084 | case SE_ERR_OOM: errMsg.append("There was not enough memory to complete the operation. "); break; |
| 1085 | case SE_ERR_PNF: errMsg.append("The specified path was not found. "); break; |
| 1086 | case SE_ERR_SHARE: errMsg.append("A sharing violation occurred. "); break; |
| 1087 | } |
| 1088 | |
| 1089 | printUnique("FileSystemManager::launchFile", errMsg); |
| 1090 | return false; |
| 1091 | |
| 1092 | } |
| 1093 | |
| 1094 | return true; |
| 1095 | } |
| 1096 | |
| 1097 | bool FileSystemManager::launchFile(QString filePath, LPWSTR verb) |
| 1098 | { |
no test coverage detected