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

akonadi

  • akonadi
protocolhelper.cpp
1 /*
2  Copyright (c) 2008 Volker Krause <vkrause@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "protocolhelper_p.h"
21 
22 #include "attributefactory.h"
23 #include "collectionstatistics.h"
24 #include "entity_p.h"
25 #include "exception.h"
26 #include "itemserializer_p.h"
27 #include "itemserializerplugin.h"
28 
29 #include <QtCore/QDateTime>
30 #include <QtCore/QFile>
31 #include <QtCore/QVarLengthArray>
32 
33 #include <kdebug.h>
34 #include <klocalizedstring.h>
35 
36 using namespace Akonadi;
37 
38 int ProtocolHelper::parseCachePolicy(const QByteArray & data, CachePolicy & policy, int start)
39 {
40  QVarLengthArray<QByteArray,16> params;
41  int end = Akonadi::ImapParser::parseParenthesizedList( data, params, start );
42  for ( int i = 0; i < params.count() - 1; i += 2 ) {
43  const QByteArray key = params[i];
44  const QByteArray value = params[i + 1];
45 
46  if ( key == "INHERIT" )
47  policy.setInheritFromParent( value == "true" );
48  else if ( key == "INTERVAL" )
49  policy.setIntervalCheckTime( value.toInt() );
50  else if ( key == "CACHETIMEOUT" )
51  policy.setCacheTimeout( value.toInt() );
52  else if ( key == "SYNCONDEMAND" )
53  policy.setSyncOnDemand( value == "true" );
54  else if ( key == "LOCALPARTS" ) {
55  QVarLengthArray<QByteArray,16> tmp;
56  QStringList parts;
57  Akonadi::ImapParser::parseParenthesizedList( value, tmp );
58  for ( int j=0; j<tmp.size(); j++ )
59  parts << QString::fromLatin1( tmp[j] );
60  policy.setLocalParts( parts );
61  }
62  }
63  return end;
64 }
65 
66 QByteArray ProtocolHelper::cachePolicyToByteArray(const CachePolicy & policy)
67 {
68  QByteArray rv = "CACHEPOLICY (";
69  if ( policy.inheritFromParent() ) {
70  rv += "INHERIT true";
71  } else {
72  rv += "INHERIT false";
73  rv += " INTERVAL " + QByteArray::number( policy.intervalCheckTime() );
74  rv += " CACHETIMEOUT " + QByteArray::number( policy.cacheTimeout() );
75  rv += " SYNCONDEMAND " + ( policy.syncOnDemand() ? QByteArray("true") : QByteArray("false") );
76  rv += " LOCALPARTS (" + policy.localParts().join( QLatin1String(" ") ).toLatin1() + ')';
77  }
78  rv += ')';
79  return rv;
80 }
81 
82 void ProtocolHelper::parseAncestorsCached( const QByteArray &data, Entity *entity, Collection::Id parentCollection,
83  ProtocolHelperValuePool *pool, int start )
84 {
85  if ( !pool || parentCollection == -1 ) {
86  // if no pool or parent collection id is provided we can't cache anything, so continue as usual
87  parseAncestors( data, entity, start );
88  return;
89  }
90 
91  if ( pool->ancestorCollections.contains( parentCollection ) ) {
92  // ancestor chain is cached already, so use the cached value
93  entity->setParentCollection( pool->ancestorCollections.value( parentCollection ) );
94  } else {
95  // not cached yet, parse the chain
96  parseAncestors( data, entity, start );
97  pool->ancestorCollections.insert( parentCollection, entity->parentCollection() );
98  }
99 }
100 
101 void ProtocolHelper::parseAncestors( const QByteArray &data, Entity *entity, int start )
102 {
103  Q_UNUSED( start );
104 
105  static const Collection::Id rootCollectionId = Collection::root().id();
106  QVarLengthArray<QByteArray, 16> ancestors;
107  QVarLengthArray<QByteArray, 16> parentIds;
108 
109  ImapParser::parseParenthesizedList( data, ancestors );
110  Entity* current = entity;
111  for ( int i = 0; i < ancestors.count(); ++i ) {
112  parentIds.clear();
113  ImapParser::parseParenthesizedList( ancestors[ i ], parentIds );
114  if ( parentIds.size() != 2 )
115  break;
116 
117  const Collection::Id uid = parentIds[ 0 ].toLongLong();
118  if ( uid == rootCollectionId ) {
119  current->setParentCollection( Collection::root() );
120  break;
121  }
122 
123  current->parentCollection().setId( uid );
124  current->parentCollection().setRemoteId( QString::fromUtf8( parentIds[ 1 ] ) );
125  current = &current->parentCollection();
126  }
127 }
128 
129 int ProtocolHelper::parseCollection(const QByteArray & data, Collection & collection, int start)
130 {
131  int pos = start;
132 
133  // collection and parent id
134  Collection::Id colId = -1;
135  bool ok = false;
136  pos = ImapParser::parseNumber( data, colId, &ok, pos );
137  if ( !ok || colId <= 0 ) {
138  kDebug() << "Could not parse collection id from response:" << data;
139  return start;
140  }
141 
142  Collection::Id parentId = -1;
143  pos = ImapParser::parseNumber( data, parentId, &ok, pos );
144  if ( !ok || parentId < 0 ) {
145  kDebug() << "Could not parse parent id from response:" << data;
146  return start;
147  }
148 
149  collection = Collection( colId );
150  collection.setParentCollection( Collection( parentId ) );
151 
152  // attributes
153  QVarLengthArray<QByteArray,16> attributes;
154  pos = ImapParser::parseParenthesizedList( data, attributes, pos );
155 
156  for ( int i = 0; i < attributes.count() - 1; i += 2 ) {
157  const QByteArray key = attributes[i];
158  const QByteArray value = attributes[i + 1];
159 
160  if ( key == "NAME" ) {
161  collection.setName( QString::fromUtf8( value ) );
162  } else if ( key == "REMOTEID" ) {
163  collection.setRemoteId( QString::fromUtf8( value ) );
164  } else if ( key == "REMOTEREVISION" ) {
165  collection.setRemoteRevision( QString::fromUtf8( value ) );
166  } else if ( key == "RESOURCE" ) {
167  collection.setResource( QString::fromUtf8( value ) );
168  } else if ( key == "MIMETYPE" ) {
169  QVarLengthArray<QByteArray,16> ct;
170  ImapParser::parseParenthesizedList( value, ct );
171  QStringList ct2;
172  for ( int j = 0; j < ct.size(); j++ )
173  ct2 << QString::fromLatin1( ct[j] );
174  collection.setContentMimeTypes( ct2 );
175  } else if ( key == "VIRTUAL" ) {
176  collection.setVirtual( value.toUInt() != 0 );
177  } else if ( key == "MESSAGES" ) {
178  CollectionStatistics s = collection.statistics();
179  s.setCount( value.toLongLong() );
180  collection.setStatistics( s );
181  } else if ( key == "UNSEEN" ) {
182  CollectionStatistics s = collection.statistics();
183  s.setUnreadCount( value.toLongLong() );
184  collection.setStatistics( s );
185  } else if ( key == "SIZE" ) {
186  CollectionStatistics s = collection.statistics();
187  s.setSize( value.toLongLong() );
188  collection.setStatistics( s );
189  } else if ( key == "CACHEPOLICY" ) {
190  CachePolicy policy;
191  ProtocolHelper::parseCachePolicy( value, policy );
192  collection.setCachePolicy( policy );
193  } else if ( key == "ANCESTORS" ) {
194  parseAncestors( value, &collection );
195  } else {
196  Attribute* attr = AttributeFactory::createAttribute( key );
197  Q_ASSERT( attr );
198  attr->deserialize( value );
199  collection.addAttribute( attr );
200  }
201  }
202 
203  return pos;
204 }
205 
206 QByteArray ProtocolHelper::attributesToByteArray(const Entity & entity, bool ns )
207 {
208  QList<QByteArray> l;
209  foreach ( const Attribute *attr, entity.attributes() ) {
210  l << encodePartIdentifier( ns ? PartAttribute : PartGlobal, attr->type() );
211  l << ImapParser::quote( attr->serialized() );
212  }
213  return ImapParser::join( l, " " );
214 }
215 
216 QByteArray ProtocolHelper::encodePartIdentifier(PartNamespace ns, const QByteArray & label, int version )
217 {
218  const QByteArray versionString( version != 0 ? '[' + QByteArray::number( version ) + ']' : "" );
219  switch ( ns ) {
220  case PartGlobal:
221  return label + versionString;
222  case PartPayload:
223  return "PLD:" + label + versionString;
224  case PartAttribute:
225  return "ATR:" + label + versionString;
226  default:
227  Q_ASSERT( false );
228  }
229  return QByteArray();
230 }
231 
232 QByteArray ProtocolHelper::decodePartIdentifier( const QByteArray &data, PartNamespace & ns )
233 {
234  if ( data.startsWith( "PLD:" ) ) { //krazy:exclude=strings
235  ns = PartPayload;
236  return data.mid( 4 );
237  } else if ( data.startsWith( "ATR:" ) ) { //krazy:exclude=strings
238  ns = PartAttribute;
239  return data.mid( 4 );
240  } else {
241  ns = PartGlobal;
242  return data;
243  }
244 }
245 
246 QByteArray ProtocolHelper::hierarchicalRidToByteArray( const Collection &col )
247 {
248  if ( col == Collection::root() )
249  return QByteArray("(0 \"\")");
250  if ( col.remoteId().isEmpty() )
251  return QByteArray();
252  const QByteArray parentHrid = hierarchicalRidToByteArray( col.parentCollection() );
253  return '(' + QByteArray::number( col.id() ) + ' ' + ImapParser::quote( col.remoteId().toUtf8() ) + ") " + parentHrid;
254 }
255 
256 QByteArray ProtocolHelper::hierarchicalRidToByteArray( const Item &item )
257 {
258  const QByteArray parentHrid = hierarchicalRidToByteArray( item.parentCollection() );
259  return '(' + QByteArray::number( item.id() ) + ' ' + ImapParser::quote( item.remoteId().toUtf8() ) + ") " + parentHrid;
260 }
261 
262 QByteArray ProtocolHelper::itemFetchScopeToByteArray( const ItemFetchScope &fetchScope )
263 {
264  QByteArray command;
265 
266  if ( fetchScope.fullPayload() )
267  command += " " AKONADI_PARAM_FULLPAYLOAD;
268  if ( fetchScope.allAttributes() )
269  command += " " AKONADI_PARAM_ALLATTRIBUTES;
270  if ( fetchScope.cacheOnly() )
271  command += " " AKONADI_PARAM_CACHEONLY;
272  if ( fetchScope.checkForCachedPayloadPartsOnly() )
273  command += " " AKONADI_PARAM_CHECKCACHEDPARTSONLY;
274  if ( fetchScope.ignoreRetrievalErrors() )
275  command += " " "IGNOREERRORS";
276  if ( fetchScope.ancestorRetrieval() != ItemFetchScope::None ) {
277  switch ( fetchScope.ancestorRetrieval() ) {
278  case ItemFetchScope::Parent:
279  command += " ANCESTORS 1";
280  break;
281  case ItemFetchScope::All:
282  command += " ANCESTORS INF";
283  break;
284  default:
285  Q_ASSERT( false );
286  }
287  }
288  if ( fetchScope.fetchChangedSince().isValid() ) {
289  command += " " AKONADI_PARAM_CHANGEDSINCE " " + QByteArray::number( fetchScope.fetchChangedSince().toTime_t() );
290  }
291 
292  //TODO: detect somehow if server supports external payload attribute
293  command += " " AKONADI_PARAM_EXTERNALPAYLOAD;
294 
295  command += " (UID REMOTEID REMOTEREVISION COLLECTIONID FLAGS SIZE";
296  if ( fetchScope.fetchModificationTime() )
297  command += " DATETIME";
298  foreach ( const QByteArray &part, fetchScope.payloadParts() )
299  command += ' ' + ProtocolHelper::encodePartIdentifier( ProtocolHelper::PartPayload, part );
300  foreach ( const QByteArray &part, fetchScope.attributes() )
301  command += ' ' + ProtocolHelper::encodePartIdentifier( ProtocolHelper::PartAttribute, part );
302  command += ")\n";
303 
304  return command;
305 }
306 
307 void ProtocolHelper::parseItemFetchResult( const QList<QByteArray> &lineTokens, Item &item, ProtocolHelperValuePool *valuePool )
308 {
309  // create a new item object
310  Item::Id uid = -1;
311  int rev = -1;
312  QString rid;
313  QString remoteRevision;
314  QString mimeType;
315  Entity::Id cid = -1;
316 
317  for ( int i = 0; i < lineTokens.count() - 1; i += 2 ) {
318  const QByteArray key = lineTokens.value( i );
319  const QByteArray value = lineTokens.value( i + 1 );
320 
321  if ( key == "UID" )
322  uid = value.toLongLong();
323  else if ( key == "REV" )
324  rev = value.toInt();
325  else if ( key == "REMOTEID" ) {
326  if ( !value.isEmpty() )
327  rid = QString::fromUtf8( value );
328  else
329  rid.clear();
330  } else if ( key == "REMOTEREVISION" ) {
331  remoteRevision = QString::fromUtf8( value );
332  } else if ( key == "COLLECTIONID" ) {
333  cid = value.toInt();
334  } else if ( key == "MIMETYPE" ) {
335  if ( valuePool )
336  mimeType = valuePool->mimeTypePool.sharedValue( QString::fromLatin1( value ) );
337  else
338  mimeType = QString::fromLatin1( value );
339  }
340  }
341 
342  if ( uid < 0 || rev < 0 || mimeType.isEmpty() ) {
343  kWarning() << "Broken fetch response: UID, RID, REV or MIMETYPE missing!";
344  return;
345  }
346 
347  item = Item( uid );
348  item.setRemoteId( rid );
349  item.setRevision( rev );
350  item.setRemoteRevision( remoteRevision );
351  item.setMimeType( mimeType );
352  item.setStorageCollectionId( cid );
353  if ( !item.isValid() )
354  return;
355 
356  // parse fetch response fields
357  for ( int i = 0; i < lineTokens.count() - 1; i += 2 ) {
358  const QByteArray key = lineTokens.value( i );
359  // skip stuff we dealt with already
360  if ( key == "UID" || key == "REV" || key == "REMOTEID" ||
361  key == "MIMETYPE" || key == "COLLECTIONID" || key == "REMOTEREVISION" )
362  continue;
363  // flags
364  if ( key == "FLAGS" ) {
365  QList<QByteArray> flags;
366  ImapParser::parseParenthesizedList( lineTokens[i + 1], flags );
367  if ( !flags.isEmpty() ) {
368  Item::Flags convertedFlags;
369  convertedFlags.reserve( flags.size() );
370  foreach ( const QByteArray &flag, flags ) {
371  if ( valuePool )
372  convertedFlags.insert( valuePool->flagPool.sharedValue( flag ) );
373  else
374  convertedFlags.insert( flag );
375  }
376  item.setFlags( convertedFlags );
377  }
378  } else if ( key == "CACHEDPARTS" ) {
379  QSet<QByteArray> partsSet;
380  QList<QByteArray> parts;
381  ImapParser::parseParenthesizedList( lineTokens[i + 1], parts );
382  foreach ( const QByteArray &part, parts ) {
383  partsSet.insert(part.mid(4));
384  }
385  item.setCachedPayloadParts( partsSet );
386  } else if ( key == "SIZE" ) {
387  const quint64 size = lineTokens[i + 1].toLongLong();
388  item.setSize( size );
389  } else if ( key == "DATETIME" ) {
390  QDateTime datetime;
391  ImapParser::parseDateTime( lineTokens[i + 1], datetime );
392  item.setModificationTime( datetime );
393  } else if ( key == "ANCESTORS" ) {
394  ProtocolHelper::parseAncestorsCached( lineTokens[i + 1], &item, cid, valuePool );
395  } else {
396  int version = 0;
397  QByteArray plainKey( key );
398  ProtocolHelper::PartNamespace ns;
399 
400  ImapParser::splitVersionedKey( key, plainKey, version );
401  plainKey = ProtocolHelper::decodePartIdentifier( plainKey, ns );
402 
403  switch ( ns ) {
404  case ProtocolHelper::PartPayload:
405  {
406  bool isExternal = false;
407  const QByteArray fileKey = lineTokens.value( i + 1 );
408  if ( fileKey == "[FILE]" ) {
409  isExternal = true;
410  i++;
411  //kDebug() << "Payload is external: " << isExternal << " filename: " << lineTokens.value( i + 1 );
412  }
413  ItemSerializer::deserialize( item, plainKey, lineTokens.value( i + 1 ), version, isExternal );
414  break;
415  }
416  case ProtocolHelper::PartAttribute:
417  {
418  Attribute* attr = AttributeFactory::createAttribute( plainKey );
419  Q_ASSERT( attr );
420  if ( lineTokens.value( i + 1 ) == "[FILE]" ) {
421  ++i;
422  QFile file( QString::fromUtf8( lineTokens.value( i + 1 ) ) );
423  if ( file.open( QFile::ReadOnly ) )
424  attr->deserialize( file.readAll() );
425  else {
426  kWarning() << "Failed to open attribute file: " << lineTokens.value( i + 1 );
427  delete attr;
428  attr = 0;
429  }
430  } else {
431  attr->deserialize( lineTokens.value( i + 1 ) );
432  }
433  if ( attr )
434  item.addAttribute( attr );
435  break;
436  }
437  case ProtocolHelper::PartGlobal:
438  default:
439  kWarning() << "Unknown item part type:" << key;
440  }
441  }
442  }
443 
444  item.d_ptr->resetChangeLog();
445 }
Akonadi::ProtocolHelper::parseCachePolicy
static int parseCachePolicy(const QByteArray &data, CachePolicy &policy, int start=0)
Parse a cache policy definition.
Definition: protocolhelper.cpp:38
Akonadi::CachePolicy::intervalCheckTime
int intervalCheckTime() const
Returns the interval check time in minutes, -1 for never.
Definition: cachepolicy.cpp:118
Akonadi::CachePolicy::setSyncOnDemand
void setSyncOnDemand(bool enable)
Sets whether the collection shall be synced automatically when necessary, i.e.
Definition: cachepolicy.cpp:133
Akonadi::ItemFetchScope::ancestorRetrieval
AncestorRetrieval ancestorRetrieval() const
Returns the ancestor retrieval depth.
Definition: itemfetchscope.cpp:124
Akonadi::CachePolicy::inheritFromParent
bool inheritFromParent() const
Returns whether it inherits cache policy from the parent collection.
Definition: cachepolicy.cpp:88
Akonadi::ItemFetchScope::None
No ancestor retrieval at all (the default)
Definition: itemfetchscope.h:76
Akonadi::CachePolicy::setIntervalCheckTime
void setIntervalCheckTime(int time)
Sets interval check time.
Definition: cachepolicy.cpp:123
Akonadi::CachePolicy::setCacheTimeout
void setCacheTimeout(int timeout)
Sets cache timeout for non-permanently cached parts.
Definition: cachepolicy.cpp:113
Akonadi::CollectionStatistics
Provides statistics information of a Collection.
Definition: collectionstatistics.h:69
Akonadi::ProtocolHelper::itemFetchScopeToByteArray
static QByteArray itemFetchScopeToByteArray(const ItemFetchScope &fetchScope)
Converts a given ItemFetchScope object into a protocol representation.
Definition: protocolhelper.cpp:262
Akonadi::Collection
Represents a collection of PIM items.
Definition: collection.h:75
Akonadi::Entity::setRemoteId
void setRemoteId(const QString &id)
Sets the remote id of the entity.
Definition: entity.cpp:77
Akonadi::Entity::Id
qint64 Id
Describes the unique id type.
Definition: entity.h:64
Akonadi::Attribute::deserialize
virtual void deserialize(const QByteArray &data)=0
Sets the data of this attribute, using the same encoding as returned by toByteArray().
Akonadi::ProtocolHelper::attributesToByteArray
static QByteArray attributesToByteArray(const Entity &entity, bool ns=false)
Convert attributes to their protocol representation.
Definition: protocolhelper.cpp:206
Akonadi::ItemFetchScope::fullPayload
bool fullPayload() const
Returns whether the full payload should be fetched.
Definition: itemfetchscope.cpp:63
Akonadi::ItemFetchScope::fetchModificationTime
bool fetchModificationTime() const
Returns whether item modification time should be retrieved.
Definition: itemfetchscope.cpp:139
Akonadi::Attribute
Provides interface for custom attributes for Entity.
Definition: attribute.h:138
Akonadi::Entity::setId
void setId(Id identifier)
Sets the unique identifier of the entity.
Definition: entity.cpp:67
Akonadi::Entity::setParentCollection
void setParentCollection(const Collection &parent)
Set the parent collection of this object.
Definition: entity.cpp:195
Akonadi::ProtocolHelper::parseCollection
static int parseCollection(const QByteArray &data, Collection &collection, int start=0)
Parse a collection description.
Definition: protocolhelper.cpp:129
Akonadi::Collection::setName
void setName(const QString &name)
Sets the i18n&#39;ed name of the collection.
Definition: collection.cpp:93
Akonadi::Collection::setVirtual
void setVirtual(bool isVirtual)
Sets whether the collection is virtual or not.
Definition: collection.cpp:266
Akonadi::Entity::parentCollection
Collection parentCollection() const
Returns the parent collection of this object.
Definition: entity.cpp:186
Akonadi::Entity::setRemoteRevision
void setRemoteRevision(const QString &revision)
Sets the remote revision of the entity.
Definition: entity.cpp:87
Akonadi::Collection::setStatistics
void setStatistics(const CollectionStatistics &statistics)
Sets the collection statistics for the collection.
Definition: collection.cpp:243
Akonadi::Entity::addAttribute
void addAttribute(Attribute *attribute)
Adds an attribute to the entity.
Definition: entity.cpp:126
Akonadi::ItemFetchScope::attributes
QSet< QByteArray > attributes() const
Returns all explicitly fetched attributes.
Definition: itemfetchscope.cpp:73
Akonadi::ItemFetchScope::Parent
Only retrieve the immediate parent collection.
Definition: itemfetchscope.h:77
Akonadi::CollectionStatistics::setUnreadCount
void setUnreadCount(qint64 count)
Sets the number of unread items in this collection.
Definition: collectionstatistics.cpp:83
Akonadi::Entity::remoteId
QString remoteId() const
Returns the remote id of the entity.
Definition: entity.cpp:82
Akonadi::ProtocolHelper::hierarchicalRidToByteArray
static QByteArray hierarchicalRidToByteArray(const Collection &col)
Converts the given collection&#39;s hierarchical RID into a protocol representation.
Definition: protocolhelper.cpp:246
Akonadi::CachePolicy::cacheTimeout
int cacheTimeout() const
Returns the cache timeout for non-permanently cached parts in minutes; -1 means indefinitely.
Definition: cachepolicy.cpp:108
Akonadi::CollectionStatistics::setSize
void setSize(qint64 size)
Sets the total size of the items in this collection.
Definition: collectionstatistics.cpp:93
Akonadi::ProtocolHelper::encodePartIdentifier
static QByteArray encodePartIdentifier(PartNamespace ns, const QByteArray &label, int version=0)
Encodes part label and namespace.
Definition: protocolhelper.cpp:216
Akonadi::Collection::root
static Collection root()
Returns the root collection.
Definition: collection.cpp:192
Akonadi::ProtocolHelper::PartNamespace
PartNamespace
Part namespaces.
Definition: protocolhelper_p.h:60
Akonadi::CachePolicy
Represents the caching policy for a collection.
Definition: cachepolicy.h:71
Akonadi::Collection::setCachePolicy
void setCachePolicy(const CachePolicy &policy)
Sets the cache policy of the collection.
Definition: collection.cpp:254
Akonadi::Entity::id
Id id() const
Returns the unique identifier of the entity.
Definition: entity.cpp:72
Akonadi::ItemSerializer::deserialize
static void deserialize(Item &item, const QByteArray &label, const QByteArray &data, int version, bool external)
throws ItemSerializerException on failure
Definition: itemserializer.cpp:81
Akonadi::ItemFetchScope::payloadParts
QSet< QByteArray > payloadParts() const
Returns the payload parts that should be fetched.
Definition: itemfetchscope.cpp:50
Akonadi::ItemFetchScope::fetchChangedSince
KDateTime fetchChangedSince() const
Returns timestamp of the oldest item to fetch.
Definition: itemfetchscope.cpp:159
Akonadi::ItemFetchScope
Specifies which parts of an item should be fetched from the Akonadi storage.
Definition: itemfetchscope.h:68
Akonadi::Entity
The base class for Item and Collection.
Definition: entity.h:58
Akonadi::CachePolicy::setLocalParts
void setLocalParts(const QStringList &parts)
Specifies the parts to permanently cache locally.
Definition: cachepolicy.cpp:103
Akonadi::ProtocolHelper::parseAncestors
static void parseAncestors(const QByteArray &data, Entity *entity, int start=0)
Convert a ancestor chain from its protocol representation into an Entity object.
Definition: protocolhelper.cpp:101
Akonadi::ItemFetchScope::checkForCachedPayloadPartsOnly
bool checkForCachedPayloadPartsOnly() const
Returns whether payload data should be fetched or only checked for presence in the cache...
Definition: itemfetchscope.cpp:118
Akonadi::AttributeFactory::createAttribute
static Attribute * createAttribute(const QByteArray &type)
Creates an entity attribute object of the given type.
Definition: attributefactory.cpp:133
Akonadi::CollectionStatistics::setCount
void setCount(qint64 count)
Sets the number of items in this collection.
Definition: collectionstatistics.cpp:73
Akonadi::ItemFetchScope::All
Retrieve all ancestors, up to Collection::root()
Definition: itemfetchscope.h:78
Akonadi::ProtocolHelper::decodePartIdentifier
static QByteArray decodePartIdentifier(const QByteArray &data, PartNamespace &ns)
Decode part label and namespace.
Definition: protocolhelper.cpp:232
Akonadi::Attribute::serialized
virtual QByteArray serialized() const =0
Returns a QByteArray representation of the attribute which will be storaged.
Akonadi::ItemFetchScope::ignoreRetrievalErrors
bool ignoreRetrievalErrors() const
Returns whether retrieval errors should be ignored.
Definition: itemfetchscope.cpp:149
Akonadi::CachePolicy::localParts
QStringList localParts() const
Returns the parts to permanently cache locally.
Definition: cachepolicy.cpp:98
Akonadi::ItemFetchScope::allAttributes
bool allAttributes() const
Returns whether all available attributes should be fetched.
Definition: itemfetchscope.cpp:86
Akonadi::ProtocolHelper::parseAncestorsCached
static void parseAncestorsCached(const QByteArray &data, Entity *entity, Collection::Id parentCollection, ProtocolHelperValuePool *valuePool=0, int start=0)
Convert a ancestor chain from its protocol representation into an Entity object.
Definition: protocolhelper.cpp:82
Akonadi::ItemFetchScope::cacheOnly
bool cacheOnly() const
Returns whether payload data should be requested from remote sources or just from the local cache...
Definition: itemfetchscope.cpp:101
Akonadi::ProtocolHelper::parseItemFetchResult
static void parseItemFetchResult(const QList< QByteArray > &lineTokens, Item &item, ProtocolHelperValuePool *valuePool=0)
Parses a single line from an item fetch job result into an Item object.
Definition: protocolhelper.cpp:307
Akonadi::Attribute::type
virtual QByteArray type() const =0
Returns the type of the attribute.
Akonadi::Collection::statistics
CollectionStatistics statistics() const
Returns the collection statistics of the collection.
Definition: collection.cpp:238
Akonadi::Collection::setResource
void setResource(const QString &identifier)
Sets the identifier of the resource owning the collection.
Definition: collection.cpp:212
Akonadi::CachePolicy::setInheritFromParent
void setInheritFromParent(bool inherit)
Sets whether the cache policy should be inherited from the parent collection.
Definition: cachepolicy.cpp:93
Akonadi::Entity::attributes
Attribute::List attributes() const
Returns a list of all attributes of the entity.
Definition: entity.cpp:151
Akonadi::Collection::setContentMimeTypes
void setContentMimeTypes(const QStringList &types)
Sets the list of possible content mime types.
Definition: collection.cpp:120
Akonadi::CachePolicy::syncOnDemand
bool syncOnDemand() const
Returns whether the collection will be synced automatically when necessary, i.e.
Definition: cachepolicy.cpp:128
Akonadi::ProtocolHelper::cachePolicyToByteArray
static QByteArray cachePolicyToByteArray(const CachePolicy &policy)
Convert a cache policy object into its protocol representation.
Definition: protocolhelper.cpp:66
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