• Skip to content
  • Skip to link menu
KDE 4.7 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

akonadi

indexpolicyattribute.cpp
00001 /*
00002     Copyright (c) 2010 Volker Krause <vkrause@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 #include "indexpolicyattribute.h"
00021 
00022 #include <akonadi/private/imapparser_p.h>
00023 
00024 #include <QtCore/QString>
00025 
00026 using namespace Akonadi;
00027 
00028 class IndexPolicyAttribute::Private
00029 {
00030   public:
00031     Private() : enable( true ) {}
00032     bool enable;
00033 };
00034 
00035 IndexPolicyAttribute::IndexPolicyAttribute()
00036   : d( new Private )
00037 {
00038 }
00039 
00040 IndexPolicyAttribute::~IndexPolicyAttribute()
00041 {
00042   delete d;
00043 }
00044 
00045 bool IndexPolicyAttribute::indexingEnabled() const
00046 {
00047   return d->enable;
00048 }
00049 
00050 void IndexPolicyAttribute::setIndexingEnabled(bool enable)
00051 {
00052   d->enable = enable;
00053 }
00054 
00055 QByteArray IndexPolicyAttribute::type() const
00056 {
00057   return "INDEXPOLICY";
00058 }
00059 
00060 Attribute* IndexPolicyAttribute::clone() const
00061 {
00062   IndexPolicyAttribute* attr = new IndexPolicyAttribute;
00063   attr->setIndexingEnabled( indexingEnabled() );
00064   return attr;
00065 }
00066 
00067 QByteArray IndexPolicyAttribute::serialized() const
00068 {
00069   QList<QByteArray> l;
00070   l.append( "ENABLE" );
00071   l.append( d->enable ? "true" : "false" );
00072   return "(" + ImapParser::join( l, " " ) + ')'; //krazy:exclude=doublequote_chars
00073 }
00074 
00075 void IndexPolicyAttribute::deserialize(const QByteArray& data)
00076 {
00077   QList<QByteArray> l;
00078   ImapParser::parseParenthesizedList( data, l );
00079   for ( int i = 0; i < l.size() - 1; i += 2 ) {
00080     const QByteArray key = l.at( i );
00081     if ( key == "ENABLE" )
00082       d->enable = l.at( i + 1 ) == "true";
00083   }
00084 }

akonadi

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal