* @brief Handles process error exit. * @param exitCode The exit code * @param p_error The error message */
| 300 | * @param p_error The error message |
| 301 | */ |
| 302 | void QtPass::processErrorExit(int exitCode, const QString &p_error) { |
| 303 | if (nullptr != m_mainWindow->getKeygenDialog()) { |
| 304 | m_mainWindow->cleanKeygenDialog(); |
| 305 | if (exitCode != 0) { |
| 306 | m_mainWindow->showStatusMessage(tr("GPG key pair generation failed"), |
| 307 | 10000); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | if (!p_error.isEmpty()) { |
| 312 | QString output; |
| 313 | QString error = p_error.toHtmlEscaped(); |
| 314 | if (exitCode == 0) { |
| 315 | // https://github.com/IJHack/qtpass/issues/111 |
| 316 | output = "<span style=\"color: darkgray;\">" + error + "</span><br />"; |
| 317 | } else { |
| 318 | output = "<span style=\"color: red;\">" + error + "</span><br />"; |
| 319 | } |
| 320 | |
| 321 | output.replace(Util::protocolRegex(), R"(<a href="\1">\1</a>)"); |
| 322 | output.replace(QStringLiteral("\n"), "<br />"); |
| 323 | |
| 324 | m_mainWindow->flashText(output, false, true); |
| 325 | } |
| 326 | |
| 327 | m_mainWindow->setUiElementsEnabled(true); |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * @brief QtPass::processFinished background process has finished |
nothing calls this directly
no test coverage detected