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

akonadi

  • akonadi
  • kmime
movecommand.cpp
1 /*
2  Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
3  Copyright (c) 2010 Andras Mantia <andras@kdab.com>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 
21 #include "movecommand_p.h"
22 #include "util_p.h"
23 
24 #include <akonadi/itemmovejob.h>
25 #include <akonadi/itemdeletejob.h>
26 
27 MoveCommand::MoveCommand( const Akonadi::Collection& destFolder,
28  const QList<Akonadi::Item> &msgList,
29  QObject *parent
30  ) : CommandBase( parent )
31 {
32  mDestFolder = destFolder;
33  mMessages = msgList;
34 }
35 
36 void MoveCommand::execute()
37 {
38  if ( mMessages.isEmpty() ) {
39  emitResult( OK );
40  return;
41  }
42  if ( mDestFolder.isValid() ) {
43  Akonadi::ItemMoveJob *job = new Akonadi::ItemMoveJob( mMessages, mDestFolder, this );
44  connect( job, SIGNAL(result(KJob*)), this, SLOT(slotMoveResult(KJob*)) );
45  }
46  else {
47  Akonadi::ItemDeleteJob *job = new Akonadi::ItemDeleteJob( mMessages, this );
48  connect( job, SIGNAL(result(KJob*)), this, SLOT(slotMoveResult(KJob*)) );
49  }
50 }
51 
52 void MoveCommand::slotMoveResult(KJob* job)
53 {
54  if ( job->error() ) {
55  // handle errors
56  Util::showJobError(job);
57  emitResult( Failed );
58  }
59  else
60  emitResult( OK );
61 }
62 
63 #include "moc_movecommand_p.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:39 by doxygen 1.8.3.1 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.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • 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