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

akonadi/kmime

addressattribute.cpp
00001 /*
00002     Copyright 2009 Constantin Berzan <exit3219@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 #include "addressattribute.h"
00021 
00022 #include <QDataStream>
00023 
00024 #include <KDebug>
00025 
00026 #include <akonadi/attributefactory.h>
00027 
00028 using namespace Akonadi;
00029 
00033 class AddressAttribute::Private
00034 {
00035   public:
00036     QString mFrom;
00037     QStringList mTo;
00038     QStringList mCc;
00039     QStringList mBcc;
00040 };
00041 
00042 AddressAttribute::AddressAttribute( const QString &from, const QStringList &to,
00043                                     const QStringList &cc, const QStringList &bcc )
00044   : d( new Private )
00045 {
00046   d->mFrom = from;
00047   d->mTo = to;
00048   d->mCc = cc;
00049   d->mBcc = bcc;
00050 }
00051 
00052 AddressAttribute::~AddressAttribute()
00053 {
00054   delete d;
00055 }
00056 
00057 AddressAttribute* AddressAttribute::clone() const
00058 {
00059   return new AddressAttribute( d->mFrom, d->mTo, d->mCc, d->mBcc );
00060 }
00061 
00062 QByteArray AddressAttribute::type() const
00063 {
00064   static const QByteArray sType( "AddressAttribute" );
00065   return sType;
00066 }
00067 
00068 QByteArray AddressAttribute::serialized() const
00069 {
00070   QByteArray serializedData;
00071   QDataStream serializer( &serializedData, QIODevice::WriteOnly );
00072   serializer.setVersion( QDataStream::Qt_4_5 );
00073   serializer << d->mFrom;
00074   serializer << d->mTo;
00075   serializer << d->mCc;
00076   serializer << d->mBcc;
00077   return serializedData;
00078 }
00079 
00080 void AddressAttribute::deserialize( const QByteArray &data )
00081 {
00082   QDataStream deserializer( data );
00083   deserializer.setVersion( QDataStream::Qt_4_5 );
00084   deserializer >> d->mFrom;
00085   deserializer >> d->mTo;
00086   deserializer >> d->mCc;
00087   deserializer >> d->mBcc;
00088 }
00089 
00090 QString AddressAttribute::from() const
00091 {
00092   return d->mFrom;
00093 }
00094 
00095 void AddressAttribute::setFrom( const QString &from )
00096 {
00097   d->mFrom = from;
00098 }
00099 
00100 QStringList AddressAttribute::to() const
00101 {
00102   return d->mTo;
00103 }
00104 
00105 void AddressAttribute::setTo( const QStringList &to )
00106 {
00107   d->mTo = to;
00108 }
00109 
00110 QStringList AddressAttribute::cc() const
00111 {
00112   return d->mCc;
00113 }
00114 
00115 void AddressAttribute::setCc( const QStringList &cc )
00116 {
00117   d->mCc = cc;
00118 }
00119 
00120 QStringList AddressAttribute::bcc() const
00121 {
00122   return d->mBcc;
00123 }
00124 
00125 void AddressAttribute::setBcc( const QStringList &bcc )
00126 {
00127   d->mBcc = bcc;
00128 }
00129 
00130 // Register the attribute when the library is loaded.
00131 namespace {
00132 
00133 bool address_dummy()
00134 {
00135   using namespace Akonadi;
00136   AttributeFactory::registerAttribute<AddressAttribute>();
00137   return true;
00138 }
00139 
00140 const bool address_registered = address_dummy();
00141 
00142 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:19:39 by doxygen 1.8.0 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-4.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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