Fix akonadimodel.cpp:1: warning: unterminated character constant
[kdepim.git] / messageviewer / headerstyle.h
blob6559bf237a9bcbce14058b5ef55f32094f28285d
1 /* -*- c++ -*-
2 headerstyle.h
4 This file is part of KMail, the KDE mail client.
5 Copyright (c) 2003 Marc Mutz <mutz@kde.org>
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the Qt library by Trolltech AS, Norway (or with modified versions
23 of Qt that use the same license as Qt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 Qt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
29 your version.
32 #ifndef __MESSAGEVIEWER_HEADERSTYLE_H__
33 #define __MESSAGEVIEWER_HEADERSTYLE_H__
35 #include "messageviewer_export.h"
37 #include <KMime/Message>
39 class QByteArray;
40 class QString;
41 class KDateTime;
43 namespace MessageViewer {
45 class HeaderStrategy;
46 class NodeHelper;
48 /** This class encapsulates the visual appearance of message
49 headers. Together with HeaderStrategy, which determines
50 which of the headers present in the message be shown, it is
51 responsible for the formatting of message headers.
53 @short Encapsulates visual appearance of message headers.
54 @author Marc Mutz <mutz@kde.org>
55 @see HeaderStrategy
56 **/
57 class MESSAGEVIEWER_EXPORT HeaderStyle {
58 protected:
59 HeaderStyle();
60 virtual ~HeaderStyle();
62 public:
64 // Factory methods:
66 enum Type {
67 Brief,
68 Plain,
69 Fancy,
70 Enterprise
71 #ifdef KDEPIM_MOBILE_UI
72 , Mobile
73 #endif
76 static HeaderStyle * create( Type type );
77 static HeaderStyle * create( const QString & type );
79 static HeaderStyle * brief();
80 static HeaderStyle * plain();
81 static HeaderStyle * fancy();
82 static HeaderStyle * enterprise();
83 #ifdef KDEPIM_MOBILE_UI
84 static HeaderStyle * mobile();
85 #endif
88 // Methods for handling the styles:
90 virtual const char * name() const = 0;
91 virtual HeaderStyle * next() const = 0;
92 virtual HeaderStyle * prev() const = 0;
95 // HeaderStyle interface:
97 virtual QString format( KMime::Message *message ) const = 0;
99 void setMessagePath( const QString &path ) { mMessagePath = path; }
100 QString messagePath() const { return mMessagePath; }
102 void setHeaderStrategy( const HeaderStrategy *strategy ) { mStrategy = strategy; }
103 const HeaderStrategy* headerStrategy() const { return mStrategy; }
105 void setVCardName( const QString &vCardName ) { mVCardName = vCardName; }
106 QString vCardName() const { return mVCardName; }
108 void setPrinting( bool printing ) { mPrinting = printing; }
109 bool isPrinting() const { return mPrinting; }
111 void setTopLevel( bool topLevel ) { mTopLevel = topLevel; }
112 bool isTopLevel() const { return mTopLevel; }
114 void setNodeHelper( NodeHelper *nodeHelper ) { mNodeHelper = nodeHelper; }
115 NodeHelper* nodeHelper() const { return mNodeHelper; }
117 void setAllowAsync( bool allowAsync ) { mAllowAsync = allowAsync; }
118 bool allowAsync() const { return mAllowAsync; }
120 void setSourceObject( QObject *sourceObject ) { mSourceObject = sourceObject; }
121 QObject* sourceObject() const { return mSourceObject; }
123 static QString dateStr(const KDateTime &dateTime);
124 static QByteArray dateShortStr(const KDateTime &dateTime);
126 private:
128 QString mMessagePath;
129 const HeaderStrategy *mStrategy;
130 QString mVCardName;
131 bool mPrinting;
132 bool mTopLevel;
133 NodeHelper *mNodeHelper;
134 bool mAllowAsync;
135 QObject *mSourceObject;
139 #endif // __MESSAGEVIEWER_HEADERSTYLE_H__