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

akonadi

  • sources
  • kde-4.14
  • 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 
40  return set;
41 }
42 
43 void ItemSerializerPlugin::overridePluginLookup(QObject *p)
44 {
45  ItemSerializer::overridePluginLookup(p);
46 }
47 
48 ItemSerializerPluginV2::~ItemSerializerPluginV2()
49 {
50 }
51 
52 QSet<QByteArray> ItemSerializerPluginV2::availableParts(const Item &item) const
53 {
54  if (item.hasPayload()) {
55  return QSet<QByteArray>();
56  }
57 
58  return QSet<QByteArray>() << Item::FullPayload;
59 }
60 
61 void ItemSerializerPluginV2::apply(Item &item, const Item &other)
62 {
63  QBuffer buffer;
64  QByteArray data(other.payloadData());
65  buffer.setBuffer(&data);
66  buffer.open(QIODevice::ReadOnly);
67 
68  foreach (const QByteArray &part, other.loadedPayloadParts()) {
69  buffer.seek(0);
70  deserialize(item, part, buffer, 0);
71  }
72 
73  buffer.close();
74 }
QByteArray
Akonadi::ItemSerializer::overridePluginLookup
static void overridePluginLookup(QObject *plugin)
Override the plugin-lookup with plugin.
Definition: itemserializer.cpp:221
Akonadi::ItemSerializerPluginV2::availableParts
virtual QSet< QByteArray > availableParts(const Item &item) const
Returns the parts available in the item item.
Definition: itemserializerplugin.cpp:52
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
QBuffer
QSet::insert
const_iterator insert(const T &value)
Akonadi::ItemSerializerPluginV2::~ItemSerializerPluginV2
virtual ~ItemSerializerPluginV2()
Destroys the item serializer plugin.
Definition: itemserializerplugin.cpp:48
QObject
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
QBuffer::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > flags)
QSet< QByteArray >
Akonadi::ItemSerializerPlugin::overridePluginLookup
static void overridePluginLookup(QObject *plugin)
Override the plugin-lookup with plugin.
Definition: itemserializerplugin.cpp:43
Akonadi::ItemSerializerPluginV2::apply
virtual void apply(Item &item, const Item &other)
Merges the payload parts in other into item.
Definition: itemserializerplugin.cpp:61
QBuffer::close
virtual void close()
QBuffer::setBuffer
void setBuffer(QByteArray *byteArray)
QBuffer::seek
virtual bool seek(qint64 pos)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:03 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
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

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