• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • header
headerstrategy_p.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  header/headerstrategy.h
3 
4  This file is part of KMail, the KDE mail client.
5  Copyright (c) 2003 Marc Mutz <mutz@kde.org>
6 
7  Copyright (c) 2013 Laurent Montel <montel@kde.org>
8 
9  KMail is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License, version 2, as
11  published by the Free Software Foundation.
12 
13  KMail is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the Qt library by Trolltech AS, Norway (or with modified versions
25  of Qt that use the same license as Qt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  Qt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 */
33 
34 #ifndef HEADERSTRATEGY_P_H
35 #define HEADERSTRATEGY_P_H
36 #include "header/headerstrategy.h"
37 #include <QStringList>
38 //
39 // AllHeaderStrategy:
40 // show everything
41 //
42 //
43 // Header tables:
44 //
45 namespace MessageViewer {
46 static const char * briefHeaders[] = {
47  "subject", "from", "cc", "bcc", "date"
48 };
49 static const int numBriefHeaders = sizeof briefHeaders / sizeof *briefHeaders;
50 
51 
52 static const char * standardHeaders[] = {
53  "subject", "from", "cc", "bcc", "to"
54 };
55 static const int numStandardHeaders = sizeof standardHeaders / sizeof *standardHeaders;
56 
57 
58 static const char * richHeaders[] = {
59  "subject", "date", "from", "cc", "bcc", "to",
60  "organization", "organisation", "reply-to",
61  "user-agent", "x-mailer", "x-bugzilla-url"
62 };
63 static const int numRichHeaders = sizeof richHeaders / sizeof *richHeaders;
64 
65 //
66 // Convenience function
67 //
68 
69 static QStringList stringList( const char * headers[], int numHeaders ) {
70  QStringList sl;
71  for ( int i = 0 ; i < numHeaders ; ++i )
72  sl.push_back( QLatin1String(headers[i]) );
73  return sl;
74 }
75 
76 
77 class AllHeaderStrategy : public HeaderStrategy {
78  friend class HeaderStrategy;
79 protected:
80  AllHeaderStrategy() : HeaderStrategy() {}
81  ~AllHeaderStrategy() {}
82 
83 public:
84  const char * name() const { return "all"; }
85 
86  DefaultPolicy defaultPolicy() const { return Display; }
87 
88  bool showHeader( const QString & ) const {
89  return true; // more efficient than default impl
90  }
91 };
92 
93 //
94 // RichHeaderStrategy:
95 // Date, Subject, From, To, CC, ### what exactly?
96 //
97 
98 class RichHeaderStrategy : public HeaderStrategy {
99  friend class HeaderStrategy;
100 protected:
101  RichHeaderStrategy()
102  : HeaderStrategy(),
103  mHeadersToDisplay( stringList( richHeaders, numRichHeaders ) ) {}
104  ~RichHeaderStrategy() {}
105 
106 public:
107  const char * name() const { return "rich"; }
108 
109  QStringList headersToDisplay() const { return mHeadersToDisplay; }
110  DefaultPolicy defaultPolicy() const { return Hide; }
111 
112 private:
113  const QStringList mHeadersToDisplay;
114 };
115 
116 //
117 // StandardHeaderStrategy:
118 // BCC, CC, Date, From, Subject, To
119 //
120 
121 class StandardHeaderStrategy : public HeaderStrategy {
122  friend class HeaderStrategy;
123 protected:
124  StandardHeaderStrategy()
125  : HeaderStrategy(),
126  mHeadersToDisplay( stringList( standardHeaders, numStandardHeaders) ) {}
127  ~StandardHeaderStrategy() {}
128 
129 public:
130  const char * name() const { return "standard"; }
131 
132  QStringList headersToDisplay() const { return mHeadersToDisplay; }
133  DefaultPolicy defaultPolicy() const { return Hide; }
134 
135 private:
136  const QStringList mHeadersToDisplay;
137 };
138 
139 //
140 // BriefHeaderStrategy
141 // From, Subject, Date
142 //
143 
144 class BriefHeaderStrategy : public HeaderStrategy {
145  friend class HeaderStrategy;
146 protected:
147  BriefHeaderStrategy()
148  : HeaderStrategy(),
149  mHeadersToDisplay( stringList( briefHeaders, numBriefHeaders ) ) {}
150  ~BriefHeaderStrategy() {}
151 
152 public:
153  const char * name() const { return "brief"; }
154 
155  QStringList headersToDisplay() const { return mHeadersToDisplay; }
156  DefaultPolicy defaultPolicy() const { return Hide; }
157 
158 private:
159  const QStringList mHeadersToDisplay;
160 };
161 
162 
163 //
164 // CustomHeaderStrategy
165 // Determined by user
166 //
167 
168 class CustomHeaderStrategy : public HeaderStrategy {
169  friend class HeaderStrategy;
170 protected:
171  CustomHeaderStrategy();
172  ~CustomHeaderStrategy() {}
173 
174 public:
175  const char * name() const { return "custom"; }
176 
177  void loadConfig();
178  QStringList headersToDisplay() const { return mHeadersToDisplay; }
179  QStringList headersToHide() const { return mHeadersToHide; }
180  DefaultPolicy defaultPolicy() const { return mDefaultPolicy; }
181 
182 private:
183  QStringList mHeadersToDisplay;
184  QStringList mHeadersToHide;
185  DefaultPolicy mDefaultPolicy;
186 };
187 
188 //
189 // CustomHeaderStrategy
190 // Determined by grantlee theme.
191 //
192 class GrantleeHeaderStrategy : public HeaderStrategy {
193  friend class HeaderStrategy;
194 protected:
195  GrantleeHeaderStrategy() {}
196  ~GrantleeHeaderStrategy() {}
197 
198 public:
199  const char * name() const { return "grantlee"; }
200  DefaultPolicy defaultPolicy() const { return Hide; }
201 };
202 
203 }
204 
205 #endif // HEADERSTRATEGY_P_H
MessageViewer::CustomHeaderStrategy::headersToHide
QStringList headersToHide() const
Definition: headerstrategy_p.h:179
MessageViewer::BriefHeaderStrategy::name
const char * name() const
Definition: headerstrategy_p.h:153
MessageViewer::briefHeaders
static const char * briefHeaders[]
Definition: headerstrategy_p.h:46
MessageViewer::CustomHeaderStrategy::name
const char * name() const
Definition: headerstrategy_p.h:175
MessageViewer::GrantleeHeaderStrategy
Definition: headerstrategy_p.h:192
MessageViewer::GrantleeHeaderStrategy::GrantleeHeaderStrategy
GrantleeHeaderStrategy()
Definition: headerstrategy_p.h:195
MessageViewer::AllHeaderStrategy
Definition: headerstrategy_p.h:77
MessageViewer::stringList
static QStringList stringList(const char *headers[], int numHeaders)
Definition: headerstrategy_p.h:69
MessageViewer::richHeaders
static const char * richHeaders[]
Definition: headerstrategy_p.h:58
MessageViewer::numRichHeaders
static const int numRichHeaders
Definition: headerstrategy_p.h:63
MessageViewer::StandardHeaderStrategy
Definition: headerstrategy_p.h:121
MessageViewer::BriefHeaderStrategy::defaultPolicy
DefaultPolicy defaultPolicy() const
Definition: headerstrategy_p.h:156
MessageViewer::HeaderStrategy
Definition: headerstrategy.h:42
MessageViewer::BriefHeaderStrategy
Definition: headerstrategy_p.h:144
MessageViewer::CustomHeaderStrategy::CustomHeaderStrategy
CustomHeaderStrategy()
MessageViewer::HeaderStrategy::Display
Definition: headerstrategy.h:79
MessageViewer::CustomHeaderStrategy::loadConfig
void loadConfig()
MessageViewer::CustomHeaderStrategy::defaultPolicy
DefaultPolicy defaultPolicy() const
Definition: headerstrategy_p.h:180
MessageViewer::RichHeaderStrategy::headersToDisplay
QStringList headersToDisplay() const
Definition: headerstrategy_p.h:109
MessageViewer::AllHeaderStrategy::defaultPolicy
DefaultPolicy defaultPolicy() const
Definition: headerstrategy_p.h:86
MessageViewer::GrantleeHeaderStrategy::~GrantleeHeaderStrategy
~GrantleeHeaderStrategy()
Definition: headerstrategy_p.h:196
MessageViewer::numBriefHeaders
static const int numBriefHeaders
Definition: headerstrategy_p.h:49
MessageViewer::RichHeaderStrategy::RichHeaderStrategy
RichHeaderStrategy()
Definition: headerstrategy_p.h:101
MessageViewer::GrantleeHeaderStrategy::defaultPolicy
DefaultPolicy defaultPolicy() const
Definition: headerstrategy_p.h:200
MessageViewer::RichHeaderStrategy::defaultPolicy
DefaultPolicy defaultPolicy() const
Definition: headerstrategy_p.h:110
MessageViewer::StandardHeaderStrategy::StandardHeaderStrategy
StandardHeaderStrategy()
Definition: headerstrategy_p.h:124
MessageViewer::CustomHeaderStrategy
Definition: headerstrategy_p.h:168
MessageViewer::CustomHeaderStrategy::headersToDisplay
QStringList headersToDisplay() const
Definition: headerstrategy_p.h:178
MessageViewer::StandardHeaderStrategy::headersToDisplay
QStringList headersToDisplay() const
Definition: headerstrategy_p.h:132
MessageViewer::RichHeaderStrategy::name
const char * name() const
Definition: headerstrategy_p.h:107
MessageViewer::RichHeaderStrategy
Definition: headerstrategy_p.h:98
MessageViewer::standardHeaders
static const char * standardHeaders[]
Definition: headerstrategy_p.h:52
headerstrategy.h
MessageViewer::GrantleeHeaderStrategy::name
const char * name() const
Definition: headerstrategy_p.h:199
MessageViewer::AllHeaderStrategy::showHeader
bool showHeader(const QString &) const
Definition: headerstrategy_p.h:88
MessageViewer::StandardHeaderStrategy::name
const char * name() const
Definition: headerstrategy_p.h:130
MessageViewer::CustomHeaderStrategy::~CustomHeaderStrategy
~CustomHeaderStrategy()
Definition: headerstrategy_p.h:172
MessageViewer::StandardHeaderStrategy::~StandardHeaderStrategy
~StandardHeaderStrategy()
Definition: headerstrategy_p.h:127
MessageViewer::AllHeaderStrategy::name
const char * name() const
Definition: headerstrategy_p.h:84
MessageViewer::HeaderStrategy::DefaultPolicy
DefaultPolicy
Definition: headerstrategy.h:79
MessageViewer::BriefHeaderStrategy::~BriefHeaderStrategy
~BriefHeaderStrategy()
Definition: headerstrategy_p.h:150
MessageViewer::BriefHeaderStrategy::BriefHeaderStrategy
BriefHeaderStrategy()
Definition: headerstrategy_p.h:147
MessageViewer::StandardHeaderStrategy::defaultPolicy
DefaultPolicy defaultPolicy() const
Definition: headerstrategy_p.h:133
MessageViewer::AllHeaderStrategy::AllHeaderStrategy
AllHeaderStrategy()
Definition: headerstrategy_p.h:80
MessageViewer::RichHeaderStrategy::~RichHeaderStrategy
~RichHeaderStrategy()
Definition: headerstrategy_p.h:104
MessageViewer::AllHeaderStrategy::~AllHeaderStrategy
~AllHeaderStrategy()
Definition: headerstrategy_p.h:81
MessageViewer::numStandardHeaders
static const int numStandardHeaders
Definition: headerstrategy_p.h:55
MessageViewer::HeaderStrategy::Hide
Definition: headerstrategy.h:79
MessageViewer::BriefHeaderStrategy::headersToDisplay
QStringList headersToDisplay() const
Definition: headerstrategy_p.h:155
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal