• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

akonadi

itemserializerplugin.cpp
00001 /*
00002     Copyright (c) 2007 Till Adam <adam@kde.org>
00003     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or modify it
00006     under the terms of the GNU Library General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or (at your
00008     option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful, but WITHOUT
00011     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013     License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to the
00017     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018     02110-1301, USA.
00019 */
00020 
00021 #include "itemserializerplugin.h"
00022 #include "item.h"
00023 
00024 #include <QtCore/QBuffer>
00025 
00026 using namespace Akonadi;
00027 
00028 ItemSerializerPlugin::~ItemSerializerPlugin()
00029 {
00030 }
00031 
00032 QSet<QByteArray> ItemSerializerPlugin::parts( const Item & item ) const
00033 {
00034   QSet<QByteArray> set;
00035   if ( item.hasPayload() )
00036     set.insert( Item::FullPayload );
00037 
00038   return set;
00039 }
00040 
00041 ItemSerializerPluginV2::~ItemSerializerPluginV2()
00042 {
00043 }
00044 
00045 QSet<QByteArray> ItemSerializerPluginV2::availableParts( const Item & item ) const
00046 {
00047   if ( item.hasPayload() )
00048     return QSet<QByteArray>();
00049 
00050   return QSet<QByteArray>() << Item::FullPayload;
00051 }
00052 
00053 void ItemSerializerPluginV2::apply( Item &item, const Item &other )
00054 {
00055   QBuffer buffer;
00056   QByteArray data( other.payloadData() );
00057   buffer.setBuffer( &data );
00058   buffer.open( QIODevice::ReadOnly );
00059 
00060   foreach ( const QByteArray &part, other.loadedPayloadParts() ) {
00061     buffer.seek( 0 );
00062     deserialize( item, part, buffer, 0 );
00063   }
00064 
00065   buffer.close();
00066 }

akonadi

Skip menu "akonadi"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • 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
Generated for KDE-PIM Libraries by doxygen 1.7.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal