20 #include "collectionmodifyjob.h"
22 #include "changemediator_p.h"
23 #include "collection_p.h"
24 #include "collectionstatistics.h"
25 #include "imapparser_p.h"
27 #include "protocolhelper_p.h"
29 #include <akonadi/private/protocol_p.h>
33 using namespace Akonadi;
35 class Akonadi::CollectionModifyJobPrivate :
public JobPrivate
47 :
Job( new CollectionModifyJobPrivate( this ), parent )
60 QByteArray command = d->newTag();
63 }
catch (
const std::exception &e ) {
65 setErrorText( QString::fromUtf8( e.what() ) );
71 if ( d->mCollection.d_func()->contentTypesChanged ) {
72 QList<QByteArray> bList;
73 foreach (
const QString &s, d->mCollection.contentMimeTypes() ) bList << s.toLatin1();
74 changes +=
" MIMETYPE (" + ImapParser::join( bList,
" " ) +
')';
76 if ( d->mCollection.parentCollection().id() >= 0 )
77 changes +=
" PARENT " + QByteArray::number( d->mCollection.parentCollection().id() );
78 if ( !d->mCollection.name().isEmpty() )
79 changes +=
" NAME " + ImapParser::quote( d->mCollection.name().toUtf8() );
80 if ( !d->mCollection.remoteId().isNull() )
81 changes +=
" REMOTEID " + ImapParser::quote( d->mCollection.remoteId().toUtf8() );
82 if ( !d->mCollection.remoteRevision().isNull() )
83 changes +=
" REMOTEREVISION " + ImapParser::quote( d->mCollection.remoteRevision().toUtf8() );
84 if ( d->mCollection.d_func()->cachePolicyChanged )
86 if ( d->mCollection.attributes().count() > 0 )
88 foreach (
const QByteArray &b, d->mCollection.d_func()->mDeletedAttributes )
90 if ( changes.isEmpty() ) {
94 command += changes +
'\n';
95 d->writeData( command );
97 ChangeMediator::invalidateCollection( d->mCollection );
103 return d->mCollection;
106 #include "collectionmodifyjob.moc"