File indexing completed on 2025-03-09 04:54:32

0001 /*  -*- c++ -*-
0002     headerstrategy.h
0003 
0004     This file is part of KMail, the KDE mail client.
0005     SPDX-FileCopyrightText: 2003 Marc Mutz <mutz@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "messageviewer_export.h"
0013 #include <QStringList>
0014 
0015 namespace MessageViewer
0016 {
0017 //
0018 // Convenience function
0019 //
0020 /**
0021  * @brief The HeaderStrategy class
0022  */
0023 class MESSAGEVIEWER_EXPORT HeaderStrategy
0024 {
0025 protected:
0026     HeaderStrategy();
0027 
0028 public:
0029     virtual ~HeaderStrategy();
0030     //
0031     // Methods for handling the strategies:
0032     //
0033     virtual const char *name() const = 0;
0034 
0035     void readConfig();
0036     //
0037     // HeaderStrategy interface:
0038     //
0039     enum DefaultPolicy {
0040         Display,
0041         Hide,
0042     };
0043 
0044     [[nodiscard]] virtual QStringList headersToDisplay() const;
0045     [[nodiscard]] virtual QStringList headersToHide() const;
0046     [[nodiscard]] virtual DefaultPolicy defaultPolicy() const = 0;
0047     [[nodiscard]] virtual bool showHeader(const QString &header) const;
0048     static QStringList stringList(const char *const headers[], int numHeaders);
0049 };
0050 }