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

akonadi

itemdeletejob.cpp

00001 /*
00002     Copyright (c) 2006 - 2007 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 "itemdeletejob.h"
00021 #include "itemmodifyjob.h"
00022 #include "job_p.h"
00023 #include "transactionjobs.h"
00024 #include "expungejob.h"
00025 
00026 using namespace Akonadi;
00027 
00028 class Akonadi::ItemDeleteJobPrivate : public JobPrivate
00029 {
00030   public:
00031     enum State {
00032       Begin,
00033       Store,
00034       Expunge,
00035       Commit
00036     };
00037 
00038     ItemDeleteJobPrivate( ItemDeleteJob *parent )
00039       : JobPrivate( parent )
00040     {
00041     }
00042 
00043     void jobDone( KJob* );
00044 
00045     Q_DECLARE_PUBLIC( ItemDeleteJob )
00046 
00047     Item mItem;
00048     State mState;
00049 };
00050 
00051 void ItemDeleteJobPrivate::jobDone( KJob * job )
00052 {
00053   Q_Q( ItemDeleteJob );
00054 
00055   if ( !job->error() ) // error is already handled by KCompositeJob
00056     q->emitResult();
00057 }
00058 
00059 ItemDeleteJob::ItemDeleteJob( const Item & item, QObject * parent )
00060   : Job( new ItemDeleteJobPrivate( this ), parent )
00061 {
00062   Q_D( ItemDeleteJob );
00063 
00064   d->mItem = item;
00065   d->mState = ItemDeleteJobPrivate::Begin;
00066 }
00067 
00068 ItemDeleteJob::~ItemDeleteJob()
00069 {
00070 }
00071 
00072 void ItemDeleteJob::doStart()
00073 {
00074   Q_D( ItemDeleteJob );
00075 
00076   TransactionBeginJob *begin = new TransactionBeginJob( this );
00077   addSubjob( begin );
00078 
00079   d->mItem.setFlag( "\\Deleted" );
00080   ItemModifyJob* store = new ItemModifyJob( d->mItem, this );
00081   store->disableRevisionCheck();
00082   addSubjob( store );
00083 
00084   ExpungeJob *expunge = new ExpungeJob( this );
00085   addSubjob( expunge );
00086 
00087   TransactionCommitJob *commit = new TransactionCommitJob( this );
00088   connect( commit, SIGNAL(result(KJob*)), SLOT(jobDone(KJob*)) );
00089   addSubjob( commit );
00090 }
00091 
00092 #include "itemdeletejob.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
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
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