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

akonadi/kmime

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • kmime
addressattribute.cpp
1 /*
2  Copyright 2009 Constantin Berzan <exit3219@gmail.com>
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 #include "addressattribute.h"
21 
22 #include <QDataStream>
23 
24 #include <KDebug>
25 
26 #include <akonadi/attributefactory.h>
27 
28 using namespace Akonadi;
29 
33 class AddressAttribute::Private
34 {
35  public:
36  QString mFrom;
37  QStringList mTo;
38  QStringList mCc;
39  QStringList mBcc;
40 };
41 
42 AddressAttribute::AddressAttribute( const QString &from, const QStringList &to,
43  const QStringList &cc, const QStringList &bcc )
44  : d( new Private )
45 {
46  d->mFrom = from;
47  d->mTo = to;
48  d->mCc = cc;
49  d->mBcc = bcc;
50 }
51 
52 AddressAttribute::~AddressAttribute()
53 {
54  delete d;
55 }
56 
57 AddressAttribute* AddressAttribute::clone() const
58 {
59  return new AddressAttribute( d->mFrom, d->mTo, d->mCc, d->mBcc );
60 }
61 
62 QByteArray AddressAttribute::type() const
63 {
64  static const QByteArray sType( "AddressAttribute" );
65  return sType;
66 }
67 
68 QByteArray AddressAttribute::serialized() const
69 {
70  QByteArray serializedData;
71  QDataStream serializer( &serializedData, QIODevice::WriteOnly );
72  serializer.setVersion( QDataStream::Qt_4_5 );
73  serializer << d->mFrom;
74  serializer << d->mTo;
75  serializer << d->mCc;
76  serializer << d->mBcc;
77  return serializedData;
78 }
79 
80 void AddressAttribute::deserialize( const QByteArray &data )
81 {
82  QDataStream deserializer( data );
83  deserializer.setVersion( QDataStream::Qt_4_5 );
84  deserializer >> d->mFrom;
85  deserializer >> d->mTo;
86  deserializer >> d->mCc;
87  deserializer >> d->mBcc;
88 }
89 
90 QString AddressAttribute::from() const
91 {
92  return d->mFrom;
93 }
94 
95 void AddressAttribute::setFrom( const QString &from )
96 {
97  d->mFrom = from;
98 }
99 
100 QStringList AddressAttribute::to() const
101 {
102  return d->mTo;
103 }
104 
105 void AddressAttribute::setTo( const QStringList &to )
106 {
107  d->mTo = to;
108 }
109 
110 QStringList AddressAttribute::cc() const
111 {
112  return d->mCc;
113 }
114 
115 void AddressAttribute::setCc( const QStringList &cc )
116 {
117  d->mCc = cc;
118 }
119 
120 QStringList AddressAttribute::bcc() const
121 {
122  return d->mBcc;
123 }
124 
125 void AddressAttribute::setBcc( const QStringList &bcc )
126 {
127  d->mBcc = bcc;
128 }
129 
130 // Register the attribute when the library is loaded.
131 namespace {
132 
133 bool address_dummy()
134 {
135  using namespace Akonadi;
136  AttributeFactory::registerAttribute<AddressAttribute>();
137  return true;
138 }
139 
140 const bool address_registered = address_dummy();
141 
142 }
Akonadi::AddressAttribute::from
QString from() const
Returns the address of the sender.
Definition: addressattribute.cpp:90
Akonadi::AddressAttribute::setTo
void setTo(const QStringList &to)
Sets the addresses of the "To: "receivers.
Definition: addressattribute.cpp:105
Akonadi::AddressAttribute::bcc
QStringList bcc() const
Returns the addresses of the "Bcc:" receivers.
Definition: addressattribute.cpp:120
Akonadi::AddressAttribute::~AddressAttribute
virtual ~AddressAttribute()
Destroys the AddressAttribute.
Definition: addressattribute.cpp:52
Akonadi::AddressAttribute::to
QStringList to() const
Returns the addresses of the "To:" receivers.
Definition: addressattribute.cpp:100
Akonadi::AddressAttribute::setFrom
void setFrom(const QString &from)
Sets the address of the sender.
Definition: addressattribute.cpp:95
Akonadi::AddressAttribute
Attribute storing the From, To, Cc, Bcc addresses of a message.
Definition: addressattribute.h:42
Akonadi::AddressAttribute::cc
QStringList cc() const
Returns the addresses of the "Cc:" receivers.
Definition: addressattribute.cpp:110
Akonadi::AddressAttribute::setBcc
void setBcc(const QStringList &bcc)
Sets the addresses of the "Bcc:" receivers.
Definition: addressattribute.cpp:125
Akonadi::AddressAttribute::AddressAttribute
AddressAttribute(const QString &from=QString(), const QStringList &to=QStringList(), const QStringList &cc=QStringList(), const QStringList &bcc=QStringList())
Creates a new AddressAttribute.
Definition: addressattribute.cpp:42
Akonadi::AddressAttribute::setCc
void setCc(const QStringList &cc)
Sets the addresses of the "Cc:" receivers.
Definition: addressattribute.cpp:115
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:55 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/kmime

Skip menu "akonadi/kmime"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

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