• 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
indexpolicyattribute.cpp
1 /*
2  Copyright (c) 2010 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 "indexpolicyattribute.h"
21 
22 #include <akonadi/private/imapparser_p.h>
23 
24 #include <QtCore/QString>
25 
26 using namespace Akonadi;
27 
28 class IndexPolicyAttribute::Private
29 {
30  public:
31  Private() : enable( true ) {}
32  bool enable;
33 };
34 
35 IndexPolicyAttribute::IndexPolicyAttribute()
36  : d( new Private )
37 {
38 }
39 
40 IndexPolicyAttribute::~IndexPolicyAttribute()
41 {
42  delete d;
43 }
44 
45 bool IndexPolicyAttribute::indexingEnabled() const
46 {
47  return d->enable;
48 }
49 
50 void IndexPolicyAttribute::setIndexingEnabled(bool enable)
51 {
52  d->enable = enable;
53 }
54 
55 QByteArray IndexPolicyAttribute::type() const
56 {
57  return "INDEXPOLICY";
58 }
59 
60 Attribute* IndexPolicyAttribute::clone() const
61 {
62  IndexPolicyAttribute* attr = new IndexPolicyAttribute;
63  attr->setIndexingEnabled( indexingEnabled() );
64  return attr;
65 }
66 
67 QByteArray IndexPolicyAttribute::serialized() const
68 {
69  QList<QByteArray> l;
70  l.append( "ENABLE" );
71  l.append( d->enable ? "true" : "false" );
72  return "(" + ImapParser::join( l, " " ) + ')'; //krazy:exclude=doublequote_chars
73 }
74 
75 void IndexPolicyAttribute::deserialize(const QByteArray& data)
76 {
77  QList<QByteArray> l;
78  ImapParser::parseParenthesizedList( data, l );
79  for ( int i = 0; i < l.size() - 1; i += 2 ) {
80  const QByteArray key = l.at( i );
81  if ( key == "ENABLE" )
82  d->enable = l.at( i + 1 ) == "true";
83  }
84 }
Akonadi::IndexPolicyAttribute::~IndexPolicyAttribute
~IndexPolicyAttribute()
Destroys the index policy attribute.
Definition: indexpolicyattribute.cpp:40
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::IndexPolicyAttribute
An attribute to specify how a collection should be indexed for searching.
Definition: indexpolicyattribute.h:35
Akonadi::Attribute
Provides interface for custom attributes for Entity.
Definition: attribute.h:138
Akonadi::IndexPolicyAttribute::setIndexingEnabled
void setIndexingEnabled(bool enable)
Sets whether this collection should be indexed at all.
Definition: indexpolicyattribute.cpp:50
Akonadi::Attribute::serialized
virtual QByteArray serialized() const =0
Returns a QByteArray representation of the attribute which will be storaged.
Akonadi::IndexPolicyAttribute::IndexPolicyAttribute
IndexPolicyAttribute()
Creates a new index policy attribute.
Definition: indexpolicyattribute.cpp:35
Akonadi::IndexPolicyAttribute::indexingEnabled
bool indexingEnabled() const
Returns whether this collection is supposed to be indexed at all.
Definition: indexpolicyattribute.cpp:45
Akonadi::Attribute::clone
virtual Attribute * clone() const =0
Creates a copy of this attribute.
Akonadi::Attribute::type
virtual QByteArray type() const =0
Returns the type of the attribute.
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