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

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 #include "itemserializer_p.h"
24 
25 #include <QtCore/QBuffer>
26 
27 using namespace Akonadi;
28 
29 ItemSerializerPlugin::~ItemSerializerPlugin()
30 {
31 }
32 
33 QSet<QByteArray> ItemSerializerPlugin::parts( const Item & item ) const
34 {
35  QSet<QByteArray> set;
36  if ( item.hasPayload() )
37  set.insert( Item::FullPayload );
38 
39  return set;
40 }
41 
42 void ItemSerializerPlugin::overridePluginLookup( QObject *p )
43 {
44  ItemSerializer::overridePluginLookup( p );
45 }
46 
47 ItemSerializerPluginV2::~ItemSerializerPluginV2()
48 {
49 }
50 
51 QSet<QByteArray> ItemSerializerPluginV2::availableParts( const Item & item ) const
52 {
53  if ( item.hasPayload() )
54  return QSet<QByteArray>();
55 
56  return QSet<QByteArray>() << Item::FullPayload;
57 }
58 
59 void ItemSerializerPluginV2::apply( Item &item, const Item &other )
60 {
61  QBuffer buffer;
62  QByteArray data( other.payloadData() );
63  buffer.setBuffer( &data );
64  buffer.open( QIODevice::ReadOnly );
65 
66  foreach ( const QByteArray &part, other.loadedPayloadParts() ) {
67  buffer.seek( 0 );
68  deserialize( item, part, buffer, 0 );
69  }
70 
71  buffer.close();
72 }
Akonadi::ItemSerializer::overridePluginLookup
static void overridePluginLookup(QObject *plugin)
Override the plugin-lookup with plugin.
Definition: itemserializer.cpp:226
Akonadi::ItemSerializerPluginV2::availableParts
virtual QSet< QByteArray > availableParts(const Item &item) const
Returns the parts available in the item item.
Definition: itemserializerplugin.cpp:51
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:29
Akonadi::ItemSerializerPluginV2::~ItemSerializerPluginV2
virtual ~ItemSerializerPluginV2()
Destroys the item serializer plugin.
Definition: itemserializerplugin.cpp:47
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:33
Akonadi::ItemSerializerPlugin::overridePluginLookup
static void overridePluginLookup(QObject *plugin)
Override the plugin-lookup with plugin.
Definition: itemserializerplugin.cpp:42
Akonadi::ItemSerializerPluginV2::apply
virtual void apply(Item &item, const Item &other)
Merges the payload parts in other into item.
Definition: itemserializerplugin.cpp:59
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by doxygen 1.8.7 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 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