* @brief displays the text as qrcode * @param text */
| 520 | * @param text |
| 521 | */ |
| 522 | void QtPass::showTextAsQRCode(const QString &text) { |
| 523 | QProcess qrencode; |
| 524 | qrencode.start(QtPassSettings::getQrencodeExecutable("/usr/bin/qrencode"), |
| 525 | QStringList() << "-o-" |
| 526 | << "-tPNG"); |
| 527 | qrencode.write(text.toUtf8()); |
| 528 | qrencode.closeWriteChannel(); |
| 529 | qrencode.waitForFinished(); |
| 530 | QByteArray output(qrencode.readAllStandardOutput()); |
| 531 | |
| 532 | if (qrencode.exitStatus() || qrencode.exitCode()) { |
| 533 | QString error(qrencode.readAllStandardError()); |
| 534 | m_mainWindow->showStatusMessage(error); |
| 535 | } else { |
| 536 | QPixmap image; |
| 537 | image.loadFromData(output, "PNG"); |
| 538 | QDialog *popup = createQRCodePopup(image); |
| 539 | popup->exec(); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | /** |
| 544 | * @brief QtPass::createQRCodePopup creates a popup dialog with the given QR |
nothing calls this directly
no test coverage detected