MailJD nbsp;·nbsp; Test Dashboard nbsp;·nbsp; Coverage
LCOV - code coverage report
Current view: top level - ui - PdfViewerWidget.h (source / functions) Coverage Total Hit
Test: MailJD Coverage (Unit + E2E) Lines: 100.0 % 1 1
Test Date: 2026-06-21 21:10:19 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <QByteArray>
       4              : #include <QString>
       5              : #include <QWidget>
       6              : 
       7              : class QLabel;
       8              : class QPdfDocument;
       9              : class QPdfView;
      10              : class QTemporaryFile;
      11              : class QToolButton;
      12              : 
      13              : // T-71.6: Inline PDF viewer backed by Qt's native PDF module (QPdfView +
      14              : // QPdfDocument). The original implementation tried to use Chromium's PDFium
      15              : // plugin via QWebEngineView, but Debian's Qt 6.4 WebEngine build does NOT
      16              : // bundle PDFium (confirmed: no pdfium symbols in libQt6WebEngineCore6).
      17              : // QPdfView renders PDF pages natively — no Chromium process, no sandbox
      18              : // issues, no second renderer.
      19              : //
      20              : // Layout:
      21              : //   ┌──────────────────────────────────────────────┐
      22              : //   │ [← Back]  [Save…]      [Zoom -] [100%] [+]   │  toolbar
      23              : //   ├──────────────────────────────────────────────┤
      24              : //   │                                              │
      25              : //   │           QPdfView (scrollable pages)        │
      26              : //   │                                              │
      27              : //   └──────────────────────────────────────────────┘
      28              : class PdfViewerWidget : public QWidget {
      29         1056 :   Q_OBJECT
      30              : 
      31              : public:
      32              :   explicit PdfViewerWidget(QWidget *parent = nullptr);
      33              :   ~PdfViewerWidget() override;
      34              : 
      35              :   // Render a PDF blob inline. Writes to a temp file, loads it into a
      36              :   // QPdfDocument, and displays it in the QPdfView.
      37              :   void load(const QByteArray &data, const QString &filename);
      38              : 
      39              :   // Close the document and delete the temp file. Called by MailView when
      40              :   // the user navigates back.
      41              :   void clear();
      42              : 
      43              : signals:
      44              :   // User clicked the "← Back" button. MailView returns to the previous
      45              :   // stack page (text/HTML body) and calls clear().
      46              :   void backRequested();
      47              : 
      48              : protected:
      49              :   void changeEvent(QEvent *event) override;
      50              : 
      51              : private:
      52              :   void ensureView();              // lazy QPdfView/QPdfDocument creation
      53              :   void setZoomDisplay(int percent);
      54              :   void changeZoom(int deltaPercent);
      55              :   void retranslateUi();
      56              : 
      57              :   QPdfView *m_pdfView = nullptr;
      58              :   QPdfDocument *m_document = nullptr;
      59              :   QLabel *m_zoomLabel = nullptr;
      60              :   QTemporaryFile *m_tempFile = nullptr;
      61              :   int m_zoomPercent = 100;
      62              : 
      63              :   // T-76.B3: Toolbar buttons stored for runtime language switching
      64              :   QToolButton *m_backBtn = nullptr;
      65              :   QToolButton *m_saveBtn = nullptr;
      66              :   QToolButton *m_zoomOutBtn = nullptr;
      67              :   QToolButton *m_zoomInBtn = nullptr;
      68              : 
      69              :   QByteArray m_currentData;
      70              :   QString m_currentFilename;
      71              : };
        

Generated by: LCOV version 2.0-1