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

akonadi

  • akonadi
itemserializerplugin.cpp
1 /*
2  Copyright (c) 2007 Till Adam <adam@kde.org>
3  Copyright (c) 2007 Volker Krause <vkrause@kde.org>
4 
5  This library is free software; you can redistribute it and/or modify it
6  under the terms of the GNU Library General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or (at your
8  option) any later version.
9 
10  This library is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13  License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to the
17  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  02110-1301, USA.
19 */
20 
21 #include "itemserializerplugin.h"
22 #include "item.h"
23 
24 #include <QtCore/QBuffer>
25 
26 using namespace Akonadi;
27 
28 ItemSerializerPlugin::~ItemSerializerPlugin()
29 {
30 }
31 
32 QSet<QByteArray> ItemSerializerPlugin::parts( const Item & item ) const
33 {
34  QSet<QByteArray> set;
35  if ( item.hasPayload() )
36  set.insert( Item::FullPayload );
37 
38  return set;
39 }
40 
41 ItemSerializerPluginV2::~ItemSerializerPluginV2()
42 {
43 }
44 
45 QSet<QByteArray> ItemSerializerPluginV2::availableParts( const Item & item ) const
46 {
47  if ( item.hasPayload() )
48  return QSet<QByteArray>();
49 
50  return QSet<QByteArray>() << Item::FullPayload;
51 }
52 
53 void ItemSerializerPluginV2::apply( Item &item, const Item &other )
54 {
55  QBuffer buffer;
56  QByteArray data( other.payloadData() );
57  buffer.setBuffer( &data );
58  buffer.open( QIODevice::ReadOnly );
59 
60  foreach ( const QByteArray &part, other.loadedPayloadParts() ) {
61  buffer.seek( 0 );
62  deserialize( item, part, buffer, 0 );
63  }
64 
65  buffer.close();
66 }
Akonadi::ItemSerializerPluginV2::availableParts
virtual QSet< QByteArray > availableParts(const Item &item) const
Returns the parts available in the item item.
Definition: itemserializerplugin.cpp:45
Akonadi::ItemSerializerPlugin::deserialize
virtual bool deserialize(Item &item, const QByteArray &label, QIODevice &data, int version)=0
Converts serialized item data provided in data into payload for item.
Akonadi::ItemSerializerPlugin::~ItemSerializerPlugin
virtual ~ItemSerializerPlugin()
Destroys the item serializer plugin.
Definition: itemserializerplugin.cpp:28
Akonadi::ItemSerializerPluginV2::~ItemSerializerPluginV2
virtual ~ItemSerializerPluginV2()
Destroys the item serializer plugin.
Definition: itemserializerplugin.cpp:41
Akonadi::ItemSerializerPlugin::parts
virtual QSet< QByteArray > parts(const Item &item) const
Returns a list of available parts for the given item payload.
Definition: itemserializerplugin.cpp:32
Akonadi::ItemSerializerPluginV2::apply
virtual void apply(Item &item, const Item &other)
Merges the payload parts in other into item.
Definition: itemserializerplugin.cpp:53
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:03:18 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

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

kdepimlibs-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • 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