• 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
  • viewer
messagedisplayformatattribute.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013 Montel Laurent <montel@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 
19 */
20 
21 #include "messagedisplayformatattribute.h"
22 #include <QByteArray>
23 #include <QDataStream>
24 
25 using namespace MessageViewer;
26 
27 class MessageViewer::MessageDisplayFormatAttributePrivate
28 {
29 public:
30  MessageDisplayFormatAttributePrivate()
31  : messageFormat(Viewer::Unknown),
32  remoteContent(false)
33  {
34 
35  }
36  Viewer::ForceDisplayTo messageFormat;
37  bool remoteContent;
38 };
39 
40 MessageDisplayFormatAttribute::MessageDisplayFormatAttribute()
41  : d(new MessageDisplayFormatAttributePrivate)
42 {
43 }
44 
45 MessageDisplayFormatAttribute::~MessageDisplayFormatAttribute()
46 {
47  delete d;
48 }
49 
50 MessageDisplayFormatAttribute *MessageDisplayFormatAttribute::clone() const
51 {
52  MessageDisplayFormatAttribute *messageDisplayFormatAttr = new MessageDisplayFormatAttribute();
53  messageDisplayFormatAttr->setMessageFormat(messageFormat());
54  messageDisplayFormatAttr->setRemoteContent(remoteContent());
55  return messageDisplayFormatAttr;
56 }
57 
58 QByteArray MessageDisplayFormatAttribute::type() const
59 {
60  static const QByteArray sType( "MessageDisplayFormatAttribute" );
61  return sType;
62 }
63 
64 QByteArray MessageDisplayFormatAttribute::serialized() const
65 {
66  QByteArray result;
67  QDataStream s( &result, QIODevice::WriteOnly );
68  s << messageFormat();
69  s << remoteContent();
70 
71  return result;
72 }
73 
74 void MessageDisplayFormatAttribute::setMessageFormat(Viewer::ForceDisplayTo html)
75 {
76  d->messageFormat = html;
77 }
78 
79 void MessageDisplayFormatAttribute::setRemoteContent(bool remote)
80 {
81  d->remoteContent = remote;
82 }
83 
84 bool MessageDisplayFormatAttribute::remoteContent() const
85 {
86  return d->remoteContent;
87 }
88 
89 Viewer::ForceDisplayTo MessageDisplayFormatAttribute::messageFormat() const
90 {
91  return d->messageFormat;
92 }
93 
94 void MessageDisplayFormatAttribute::deserialize( const QByteArray &data )
95 {
96  QDataStream s( data );
97  int value = 0;
98  s >> value;
99  d->messageFormat = static_cast<Viewer::ForceDisplayTo>(value);
100  s >> d->remoteContent;
101 }
MessageViewer::MessageDisplayFormatAttribute::remoteContent
bool remoteContent() const
Definition: messagedisplayformatattribute.cpp:84
MessageViewer::MessageDisplayFormatAttribute::clone
MessageDisplayFormatAttribute * clone() const
Definition: messagedisplayformatattribute.cpp:50
MessageViewer::MessageDisplayFormatAttribute::messageFormat
Viewer::ForceDisplayTo messageFormat() const
Definition: messagedisplayformatattribute.cpp:89
MessageViewer::MessageDisplayFormatAttribute::deserialize
void deserialize(const QByteArray &data)
Definition: messagedisplayformatattribute.cpp:94
MessageViewer::MessageDisplayFormatAttribute::~MessageDisplayFormatAttribute
~MessageDisplayFormatAttribute()
Definition: messagedisplayformatattribute.cpp:45
messagedisplayformatattribute.h
MessageViewer::MessageDisplayFormatAttribute::type
QByteArray type() const
Definition: messagedisplayformatattribute.cpp:58
MessageViewer::Viewer
This is the main widget for the viewer.
Definition: viewer.h:80
MessageViewer::Viewer::ForceDisplayTo
ForceDisplayTo
Definition: viewer.h:108
MessageViewer::MessageDisplayFormatAttribute::MessageDisplayFormatAttribute
MessageDisplayFormatAttribute()
Definition: messagedisplayformatattribute.cpp:40
MessageViewer::MessageDisplayFormatAttribute::setRemoteContent
void setRemoteContent(bool remote)
Definition: messagedisplayformatattribute.cpp:79
MessageViewer::MessageDisplayFormatAttribute
Definition: messagedisplayformatattribute.h:29
MessageViewer::MessageDisplayFormatAttribute::serialized
QByteArray serialized() const
Definition: messagedisplayformatattribute.cpp:64
MessageViewer::MessageDisplayFormatAttribute::setMessageFormat
void setMessageFormat(Viewer::ForceDisplayTo format)
Definition: messagedisplayformatattribute.cpp:74
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