• Skip to content
  • Skip to link menu
KDE 4.5 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • 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 
00028 using namespace Akonadi;
00029 
00030 class Akonadi::SearchCreateJobPrivate : public JobPrivate
00031 {
00032   public:
00033     SearchCreateJobPrivate( SearchCreateJob *parent )
00034       : JobPrivate( parent )
00035     {
00036     }
00037 
00038     QString mName;
00039     QString mQuery;
00040     Collection mCreatedCollection;
00041 };
00042 
00043 SearchCreateJob::SearchCreateJob( const QString & name, const QString & query, QObject * parent )
00044   : Job( new SearchCreateJobPrivate( this ), parent )
00045 {
00046   Q_D( SearchCreateJob );
00047 
00048   d->mName = name;
00049   d->mQuery = query;
00050 }
00051 
00052 SearchCreateJob::~SearchCreateJob()
00053 {
00054 }
00055 
00056 void SearchCreateJob::doStart()
00057 {
00058   Q_D( SearchCreateJob );
00059 
00060   QByteArray command = d->newTag() + " SEARCH_STORE ";
00061   command += ImapParser::quote( d->mName.toUtf8() );
00062   command += ' ';
00063   command += ImapParser::quote( d->mQuery.toUtf8() );
00064   command += '\n';
00065   d->writeData( command );
00066 }
00067 
00068 Collection SearchCreateJob::createdCollection() const
00069 {
00070   Q_D( const SearchCreateJob );
00071   return d->mCreatedCollection;
00072 }
00073 
00074 void SearchCreateJob::doHandleResponse( const QByteArray &tag, const QByteArray &data )
00075 {
00076   Q_D( SearchCreateJob );
00077   if ( tag == "*" ) {
00078    ProtocolHelper::parseCollection( data, d->mCreatedCollection );
00079    return;
00080   }
00081   kDebug() << "Unhandled response: " << tag << data;
00082 }
00083 
00084 #include "searchcreatejob.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
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • 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.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