MailJD nbsp;·nbsp; Test Dashboard nbsp;·nbsp; Coverage
LCOV - code coverage report
Current view: top level - ui - CheckableFolderCombo.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 <QComboBox>
       4              : #include <QStringList>
       5              : 
       6              : class QStandardItemModel;
       7              : 
       8              : // Sprint 60 (U2): a QComboBox whose popup is a checkable list of folder paths,
       9              : // allowing MULTIPLE folders to be selected at once. The closed combo shows a
      10              : // short summary ("All folders" / "<path>" / "N folders"). It is a pure VIEW —
      11              : // it knows only a flat list of folder paths and reports check changes via
      12              : // selectionChanged(), so it can be unit-tested without MainWindow or IMAP.
      13              : //
      14              : // API mirrors how SearchPanel used the old editable QComboBox:
      15              : //   setFolders()        — populate the available choices (resets checks)
      16              : //   setCheckedFolders() — programmatically set which are checked (no signal)
      17              : //   checkedFolders()    — read the checked paths, in folder order
      18              : class CheckableFolderCombo : public QComboBox {
      19          237 :   Q_OBJECT
      20              : 
      21              : public:
      22              :   explicit CheckableFolderCombo(QWidget *parent = nullptr);
      23              : 
      24              :   // Replace the available folder list. Any previous check state is dropped.
      25              :   // Does NOT emit selectionChanged().
      26              :   void setFolders(const QStringList &paths);
      27              : 
      28              :   // The currently checked folder paths, in the order they appear in the list.
      29              :   QStringList checkedFolders() const;
      30              : 
      31              :   // Check exactly the given paths (others are unchecked). Paths not present in
      32              :   // the current folder list are ignored. Does NOT emit selectionChanged().
      33              :   void setCheckedFolders(const QStringList &paths);
      34              : 
      35              : signals:
      36              :   // Emitted whenever the set of checked folders changes due to USER interaction
      37              :   // (a checkbox toggled in the popup). Programmatic changes via
      38              :   // setFolders()/setCheckedFolders() do NOT emit this.
      39              :   void selectionChanged();
      40              : 
      41              : protected:
      42              :   // Keep the popup open after a click so multiple boxes can be toggled, and
      43              :   // never let the combo paint a "current item" — we paint our own summary.
      44              :   bool eventFilter(QObject *obj, QEvent *event) override;
      45              :   void changeEvent(QEvent *event) override;
      46              : 
      47              : private:
      48              :   void updateSummaryText();
      49              :   void retranslateUi();
      50              : 
      51              :   QStandardItemModel *m_model = nullptr;
      52              :   QString m_emptyText;
      53              :   // When true, item changes are programmatic (setFolders/setCheckedFolders):
      54              :   // update the summary but do NOT emit selectionChanged().
      55              :   bool m_suppressSignal = false;
      56              : };
        

Generated by: LCOV version 2.0-1