Messagelib

headerstrategy.cpp
1 /* -*- c++ -*-
2  headerstrategy.cpp
3 
4  This file is part of KMail, the KDE mail client.
5  SPDX-FileCopyrightText: 2003 Marc Mutz <[email protected]>
6 
7  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
8 
9  SPDX-License-Identifier: GPL-2.0-or-later
10 */
11 
12 #include "headerstrategy.h"
13 
14 //
15 // HeaderStrategy abstract base:
16 //
17 using namespace MessageViewer;
18 HeaderStrategy::HeaderStrategy() = default;
19 
20 HeaderStrategy::~HeaderStrategy() = default;
21 
22 QStringList HeaderStrategy::headersToDisplay() const
23 {
24  return {};
25 }
26 
27 QStringList HeaderStrategy::headersToHide() const
28 {
29  return {};
30 }
31 
32 bool HeaderStrategy::showHeader(const QString &header) const
33 {
34  const QString headerLower(header.toLower());
35  if (headersToDisplay().contains(headerLower)) {
36  return true;
37  }
38  if (headersToHide().contains(headerLower)) {
39  return false;
40  }
41  return defaultPolicy() == Display;
42 }
43 
44 QStringList HeaderStrategy::stringList(const char *const headers[], int numHeaders)
45 {
46  QStringList sl;
47  sl.reserve(numHeaders);
48  for (int i = 0; i < numHeaders; ++i) {
49  sl.push_back(QLatin1String(headers[i]));
50  }
51  return sl;
52 }
void push_back(const T &value)
void reserve(int alloc)
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
QString toLower() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.