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

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <QDialog>
       4              : #include <QJsonArray>
       5              : #include <QStringList>
       6              : 
       7              : class QTreeWidget;
       8              : class QTreeWidgetItem;
       9              : class QListWidget;
      10              : 
      11              : /**
      12              :  * @brief Dialog for managing folder subscriptions (T-062).
      13              :  *
      14              :  * Shows all IMAP folders with checkboxes. Checked folders will be polled
      15              :  * for unread counts when not actively selected. Subscriptions are persisted
      16              :  * to a JSON file in the configuration directory.
      17              :  */
      18              : class FolderSubscriptionDialog : public QDialog {
      19           13 :   Q_OBJECT
      20              :   friend class TestSprint55Dialogs;
      21              :   friend class TestMainWindow;
      22              : 
      23              : public:
      24              :   explicit FolderSubscriptionDialog(const QStringList &allFolders,
      25              :                                     const QStringList &subscribedFolders,
      26              :                                     const QStringList &hiddenFolders,
      27              :                                     QWidget *parent = nullptr);
      28              : 
      29              :   /// Returns the list of checked (subscribed) folder paths.
      30              :   QStringList subscribedFolders() const;
      31              : 
      32              :   /// Returns the (potentially modified) list of hidden folder paths.
      33           11 :   QStringList hiddenFolders() const { return m_hidden; }
      34              : 
      35              :   // ── Persistence ──
      36              : 
      37              :   /// Load subscribed folder paths from config JSON.
      38              :   /// Returns empty list if file doesn't exist yet.
      39              :   static QStringList loadSubscriptions(const QString &configDir);
      40              : 
      41              :   /// Save subscribed folder paths to config JSON.
      42              :   static void saveSubscriptions(const QString &configDir,
      43              :                                 const QStringList &folders);
      44              : 
      45              :   /// Load hidden folder paths from config JSON.
      46              :   static QStringList loadHidden(const QString &configDir);
      47              : 
      48              :   /// Save hidden folder paths to config JSON.
      49              :   static void saveHidden(const QString &configDir,
      50              :                          const QStringList &folders);
      51              : 
      52              : private:
      53              :   // T-304: Runtime language switching
      54              :   void retranslateUi();
      55              : 
      56              : protected:
      57              :   void changeEvent(QEvent *event) override;
      58              : 
      59              :   void buildTree(const QStringList &allFolders,
      60              :                  const QStringList &subscribed);
      61              :   void collectChecked(QTreeWidgetItem *item, QStringList &result) const;
      62              :   void setCheckAll(Qt::CheckState state);
      63              : 
      64              :   QTreeWidget *m_tree;
      65              :   QListWidget *m_hiddenList = nullptr; // T-077
      66              :   QStringList m_hidden;               // T-077
      67              : };
        

Generated by: LCOV version 2.0-1