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

akonadi

searchcreatejob.cpp
00001 
00002 /*
00003     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or modify it
00006     under the terms of the GNU Library General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or (at your
00008     option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful, but WITHOUT
00011     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013     License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to the
00017     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018     02110-1301, USA.
00019 */
00020 
00021 #include "searchcreatejob.h"
00022 
00023 #include "collection.h"
00024 #include "imapparser_p.h"
00025 #include "protocolhelper_p.h"
00026 #include "job_p.h"
00027 #include <akonadi/private/protocol_p.h>
00028 
00029 using namespace Akonadi;
00030 
00031 class Akonadi::SearchCreateJobPrivate : public JobPrivate
00032 {
00033   public:
00034     SearchCreateJobPrivate( SearchCreateJob *parent )
00035       : JobPrivate( parent )
00036     {
00037     }
00038 
00039     QString mName;
00040     QString mQuery;
00041     QString mQueryLanguage;
00042     Collection mCreatedCollection;
00043 };
00044 
00045 SearchCreateJob::SearchCreateJob( const QString & name, const QString & query, QObject * parent )
00046   : Job( new SearchCreateJobPrivate( this ), parent )
00047 {
00048   Q_D( SearchCreateJob );
00049 
00050   d->mName = name;
00051   d->mQuery = query;
00052 }
00053 
00054 SearchCreateJob::~SearchCreateJob()
00055 {
00056 }
00057 
00058 void SearchCreateJob::setQueryLanguage(const QString& queryLanguage)
00059 {
00060   Q_D( SearchCreateJob );
00061   d->mQueryLanguage = queryLanguage;
00062 }
00063 
00064 void SearchCreateJob::doStart()
00065 {
00066   Q_D( SearchCreateJob );
00067 
00068   QByteArray command = d->newTag() + " SEARCH_STORE ";
00069   command += ImapParser::quote( d->mName.toUtf8() );
00070   command += ' ';
00071   command += ImapParser::quote( d->mQuery.toUtf8() );
00072   if ( !d->mQueryLanguage.isEmpty() ) {
00073     command += " (" AKONADI_PARAM_PERSISTENTSEARCH_QUERYLANG " ";
00074     command += ImapParser::quote( d->mQueryLanguage.toUtf8() );
00075     command += ')';
00076   }
00077   command += '\n';
00078   d->writeData( command );
00079 }
00080 
00081 Akonadi::Collection SearchCreateJob::createdCollection() const
00082 {
00083   Q_D( const SearchCreateJob );
00084   return d->mCreatedCollection;
00085 }
00086 
00087 void SearchCreateJob::doHandleResponse( const QByteArray &tag, const QByteArray &data )
00088 {
00089   Q_D( SearchCreateJob );
00090   if ( tag == "*" ) {
00091    ProtocolHelper::parseCollection( data, d->mCreatedCollection );
00092    return;
00093   }
00094   kDebug() << "Unhandled response: " << tag << data;
00095 }
00096 
00097 #include "searchcreatejob.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:00:45 by doxygen 1.8.0 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.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • 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
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