• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

akonadi

collectionmodifyjob.cpp

00001 /*
00002     Copyright (c) 2006 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 "collectionmodifyjob.h"
00021 #include "imapparser_p.h"
00022 #include "job_p.h"
00023 #include "protocolhelper.h"
00024 #include "collectionstatistics.h"
00025 #include "collection_p.h"
00026 
00027 using namespace Akonadi;
00028 
00029 class Akonadi::CollectionModifyJobPrivate : public JobPrivate
00030 {
00031   public:
00032     CollectionModifyJobPrivate( CollectionModifyJob *parent )
00033       : JobPrivate( parent )
00034     {
00035     }
00036 
00037     Collection mCollection;
00038 };
00039 
00040 CollectionModifyJob::CollectionModifyJob( const Collection &collection, QObject * parent )
00041   : Job( new CollectionModifyJobPrivate( this ), parent )
00042 {
00043   Q_D( CollectionModifyJob );
00044 
00045   Q_ASSERT( collection.isValid() );
00046   d->mCollection = collection;
00047 }
00048 
00049 CollectionModifyJob::~CollectionModifyJob()
00050 {
00051 }
00052 
00053 void CollectionModifyJob::doStart()
00054 {
00055   Q_D( CollectionModifyJob );
00056 
00057   QByteArray command = d->newTag() + " MODIFY " + QByteArray::number( d->mCollection.id() );
00058   QByteArray changes;
00059   if ( d->mCollection.d_func()->contentTypesChanged ) {
00060     QList<QByteArray> bList;
00061     foreach( const QString &s, d->mCollection.contentMimeTypes() ) bList << s.toLatin1();
00062     changes += " MIMETYPE (" + ImapParser::join( bList, " " ) + ')';
00063   }
00064   if ( d->mCollection.parent() >= 0 )
00065     changes += " PARENT " + QByteArray::number( d->mCollection.parent() );
00066   if ( !d->mCollection.name().isEmpty() )
00067     changes += " NAME " + ImapParser::quote( d->mCollection.name().toUtf8() );
00068   if ( !d->mCollection.remoteId().isNull() )
00069     changes += " REMOTEID " + ImapParser::quote( d->mCollection.remoteId().toUtf8() );
00070   if ( d->mCollection.d_func()->cachePolicyChanged )
00071     changes += ' ' + ProtocolHelper::cachePolicyToByteArray( d->mCollection.cachePolicy() );
00072   if ( d->mCollection.attributes().count() > 0 )
00073     changes += ' ' + ProtocolHelper::attributesToByteArray( d->mCollection );
00074   foreach ( const QByteArray &b, d->mCollection.d_func()->mDeletedAttributes )
00075     changes += " -" + b;
00076   if ( changes.isEmpty() ) {
00077     emitResult();
00078     return;
00079   }
00080   command += changes + '\n';
00081   d->writeData( command );
00082 }
00083 
00084 #include "collectionmodifyjob.moc"

akonadi

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.7.1
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