MailJD nbsp;·nbsp; Test Dashboard nbsp;·nbsp; Coverage
LCOV - code coverage report
Current view: top level - ui - SearchPanel.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 <QWidget>
       4              : 
       5              : #include "data/MailCache.h"
       6              : 
       7              : class QLineEdit;
       8              : class QToolButton;
       9              : class FlowLayout;
      10              : class FilterPopoverWidget;
      11              : class FilterChipWidget;
      12              : 
      13              : class SearchPanel : public QWidget {
      14          304 :   Q_OBJECT
      15              : 
      16              : public:
      17              :   explicit SearchPanel(QWidget *parent = nullptr);
      18              : 
      19              :   // Populate every control from the given state. Signals are blocked while the
      20              :   // controls are updated so this never triggers a searchRequested()/cleared().
      21              :   void setState(const QString &freeText, const MailCache::SearchFilter &filter);
      22              : 
      23              :   QString freeText() const;
      24              :   MailCache::SearchFilter filter() const;
      25              : 
      26              :   // Suggestions for the folder combo and the tag field.
      27              :   void setKnownFolders(const QStringList &paths);
      28              :   void setKnownTags(const QStringList &tags);
      29              : 
      30              : signals:
      31              :   // The user asked to run the search (pressed Enter in a field or clicked the
      32              :   // "Search" button). MainWindow turns the current state into a query and runs
      33              :   // the shared search path.
      34              :   void searchRequested();
      35              : 
      36              :   // The user clicked "Reset": all fields have been cleared.
      37              :   void cleared();
      38              : 
      39              :   // Sprint 60 (U4): any single control changed due to USER interaction. The app
      40              :   // uses this to live-update the search string and trigger a debounced search.
      41              :   // setState() blocks all controls, so programmatic repopulation never emits it.
      42              :   void filterEdited();
      43              : 
      44              : protected:
      45              :   void mousePressEvent(QMouseEvent *event) override;
      46              :   void changeEvent(QEvent *event) override;
      47              : 
      48              : private:
      49              :   void setupUi();
      50              :   void onQueryFieldEdited();
      51              :   void onPopoverFilterEdited();
      52              :   void applyFilterToControls(const MailCache::SearchFilter &filter);
      53              :   void rebuildQueryField();
      54              :   void syncChipsFromFilter(const MailCache::SearchFilter &filter);
      55              :   void clearChips();
      56              :   void onChipRemoveRequested(const QString &field);
      57              :   void removeFilterField(MailCache::SearchFilter &f, const QString &field);
      58              :   void retranslateUi();
      59              : 
      60              :   QWidget *m_searchBarContainer = nullptr;
      61              :   FlowLayout *m_flowLayout = nullptr;
      62              :   QLineEdit *m_freeText = nullptr;
      63              :   QToolButton *m_popoverButton = nullptr;
      64              :   FilterPopoverWidget *m_popover = nullptr;
      65              :   
      66              :   QList<FilterChipWidget *> m_chips;
      67              : };
        

Generated by: LCOV version 2.0-1