• 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
headerstyle.cpp
Go to the documentation of this file.
1 /* -*- c++ -*-
2  headerstyle.cpp
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 #include "headerstyle.h"
35 #include "header/briefheaderstyle.h"
36 #include "header/grantleeheaderstyle.h"
37 #include "header/customheaderstyle.h"
38 #include "header/plainheaderstyle.h"
39 #include "header/mobileheaderstyle.h"
40 #include "header/entrepriseheaderstyle.h"
41 #include "header/fancyheaderstyle.h"
42 
43 #include <KDebug>
44 #include <KGlobal>
45 #include <KLocale>
46 
47 #include "messagecore/settings/globalsettings.h"
48 
49 using namespace MessageCore;
50 
51 
52 namespace MessageViewer {
53 // #####################
54 
55 //
56 // HeaderStyle abstract base:
57 //
58 
59 HeaderStyle::HeaderStyle()
60  : mStrategy( 0 ),
61  mPrinting( false ),
62  mTopLevel( true ),
63  mNodeHelper( 0 ),
64  mAllowAsync( false ),
65  mSourceObject( 0 )
66 {
67 }
68 
69 HeaderStyle::~HeaderStyle() {
70 
71 }
72 
73 bool HeaderStyle::hasAttachmentQuickList() const
74 {
75  return false;
76 }
77 
78 HeaderStyle * HeaderStyle::create( Type type ) {
79  switch ( type ) {
80  case Brief: return brief();
81  case Plain: return plain();
82  case Fancy: return fancy();
83  case Enterprise: return enterprise();
84  case Mobile: return mobile();
85  case MobileExtended: return mobileExtended();
86  case Custom: return custom();
87  case Grantlee: return grantlee();
88  }
89  kFatal() << "Unknown header style ( type ==" << (int)type << ") requested!";
90  return 0; // make compiler happy
91 }
92 
93 HeaderStyle * HeaderStyle::create( const QString & type ) {
94  const QString lowerType = type.toLower();
95  if ( lowerType == QLatin1String("brief") ) return brief();
96  else if ( lowerType == QLatin1String("plain") ) return plain();
97  else if ( lowerType == QLatin1String("enterprise") ) return enterprise();
98  else if ( lowerType == QLatin1String("mobile") ) return mobile();
99  else if ( lowerType == QLatin1String("mobileExtended") ) return mobileExtended();
100  else if ( lowerType == QLatin1String("custom") ) return custom();
101  else if ( lowerType == QLatin1String("grantlee")) return grantlee();
102  //if ( lowerType == "fancy" ) return fancy(); // not needed, see below
103  // don't kFatal here, b/c the strings are user-provided
104  // (KConfig), so fail gracefully to the default:
105  return fancy();
106 }
107 
108 HeaderStyle * briefStyle = 0;
109 HeaderStyle * plainStyle = 0;
110 HeaderStyle * fancyStyle = 0;
111 HeaderStyle * enterpriseStyle = 0;
112 HeaderStyle * mobileStyle = 0;
113 HeaderStyle * mobileExtendedStyle = 0;
114 HeaderStyle * customStyle = 0;
115 HeaderStyle * grantleeStyle = 0;
116 
117 HeaderStyle * HeaderStyle::brief() {
118  if ( !briefStyle )
119  briefStyle = new BriefHeaderStyle();
120  return briefStyle;
121 }
122 
123 HeaderStyle * HeaderStyle::plain() {
124  if ( !plainStyle )
125  plainStyle = new MessageViewer::PlainHeaderStyle();
126  return plainStyle;
127 }
128 
129 HeaderStyle * HeaderStyle::fancy() {
130  if ( !fancyStyle )
131  fancyStyle = new MessageViewer::FancyHeaderStyle();
132  return fancyStyle;
133 }
134 
135 HeaderStyle * HeaderStyle::enterprise() {
136  if ( !enterpriseStyle )
137  enterpriseStyle = new MessageViewer::EnterpriseHeaderStyle();
138  return enterpriseStyle;
139 }
140 
141 HeaderStyle * HeaderStyle::mobile() {
142  if ( !mobileStyle )
143  mobileStyle = new MessageViewer::MobileHeaderStyle();
144  return mobileStyle;
145 }
146 
147 HeaderStyle * HeaderStyle::mobileExtended() {
148  if ( !mobileExtendedStyle )
149  mobileExtendedStyle = new MessageViewer::MobileExtendedHeaderStyle;
150  return mobileExtendedStyle;
151 }
152 
153 HeaderStyle * HeaderStyle::custom() {
154  if ( !customStyle )
155  customStyle = new MessageViewer::CustomHeaderStyle;
156  return customStyle;
157 }
158 
159 HeaderStyle * HeaderStyle::grantlee() {
160  if ( !grantleeStyle )
161  grantleeStyle = new MessageViewer::GrantleeHeaderStyle;
162  return grantleeStyle;
163 }
164 
165 }
MessageViewer::MobileHeaderStyle
Definition: mobileheaderstyle.h:23
MessageViewer::fancyStyle
HeaderStyle * fancyStyle
Definition: headerstyle.cpp:110
MessageViewer::HeaderStyle
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:60
customheaderstyle.h
briefheaderstyle.h
MessageViewer::HeaderStyle::Brief
Definition: headerstyle.h:70
MessageViewer::FancyHeaderStyle
Definition: fancyheaderstyle.h:25
MessageViewer::HeaderStyle::plain
static HeaderStyle * plain()
Definition: headerstyle.cpp:123
MessageViewer::customStyle
HeaderStyle * customStyle
Definition: headerstyle.cpp:114
MessageViewer::HeaderStyle::Mobile
Definition: headerstyle.h:74
MessageViewer::enterpriseStyle
HeaderStyle * enterpriseStyle
Definition: headerstyle.cpp:111
MessageViewer::HeaderStyle::mobileExtended
static HeaderStyle * mobileExtended()
Definition: headerstyle.cpp:147
headerstyle.h
grantleeheaderstyle.h
MessageViewer::PlainHeaderStyle
Definition: plainheaderstyle.h:25
MessageViewer::HeaderStyle::create
static HeaderStyle * create(Type type)
Definition: headerstyle.cpp:78
MessageViewer::HeaderStyle::Enterprise
Definition: headerstyle.h:73
MessageViewer::MobileExtendedHeaderStyle
Definition: mobileheaderstyle.h:35
MessageViewer::HeaderStyle::Plain
Definition: headerstyle.h:71
MessageViewer::EnterpriseHeaderStyle
Definition: entrepriseheaderstyle.h:25
MessageViewer::mobileExtendedStyle
HeaderStyle * mobileExtendedStyle
Definition: headerstyle.cpp:113
MessageViewer::HeaderStyle::fancy
static HeaderStyle * fancy()
Definition: headerstyle.cpp:129
MessageViewer::grantleeStyle
HeaderStyle * grantleeStyle
Definition: headerstyle.cpp:115
MessageViewer::HeaderStyle::~HeaderStyle
virtual ~HeaderStyle()
Definition: headerstyle.cpp:69
MessageViewer::CustomHeaderStyle
Definition: customheaderstyle.h:25
MessageViewer::GrantleeHeaderStyle
Definition: grantleeheaderstyle.h:27
type
const char * type
Definition: bodypartformatter.cpp:192
MessageViewer::HeaderStyle::grantlee
static HeaderStyle * grantlee()
Definition: headerstyle.cpp:159
entrepriseheaderstyle.h
MessageViewer::briefStyle
HeaderStyle * briefStyle
Definition: headerstyle.cpp:108
fancyheaderstyle.h
MessageViewer::HeaderStyle::mobile
static HeaderStyle * mobile()
Definition: headerstyle.cpp:141
MessageViewer::mobileStyle
HeaderStyle * mobileStyle
Definition: headerstyle.cpp:112
mobileheaderstyle.h
MessageViewer::HeaderStyle::Fancy
Definition: headerstyle.h:72
MessageViewer::BriefHeaderStyle
Definition: briefheaderstyle.h:41
MessageViewer::HeaderStyle::Type
Type
Definition: headerstyle.h:69
MessageViewer::HeaderStyle::hasAttachmentQuickList
virtual bool hasAttachmentQuickList() const
Definition: headerstyle.cpp:73
MessageViewer::HeaderStyle::Custom
Definition: headerstyle.h:76
plainheaderstyle.h
MessageViewer::HeaderStyle::MobileExtended
Definition: headerstyle.h:75
MessageViewer::HeaderStyle::brief
static HeaderStyle * brief()
Definition: headerstyle.cpp:117
MessageViewer::HeaderStyle::enterprise
static HeaderStyle * enterprise()
Definition: headerstyle.cpp:135
MessageViewer::HeaderStyle::custom
static HeaderStyle * custom()
Definition: headerstyle.cpp:153
MessageViewer::HeaderStyle::Grantlee
Definition: headerstyle.h:77
MessageViewer::plainStyle
HeaderStyle * plainStyle
Definition: headerstyle.cpp:109
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