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

akonadi/kmime

  • 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#include "movecommand_p.h"
21#include "util_p.h"
22
23#include <akonadi/itemmovejob.h>
24#include <akonadi/itemdeletejob.h>
25
26MoveCommand::MoveCommand(const Akonadi::Collection &destFolder,
27 const QList<Akonadi::Item> &msgList,
28 QObject *parent)
29 : CommandBase(parent)
30{
31 mDestFolder = destFolder;
32 mMessages = msgList;
33}
34
35void MoveCommand::execute()
36{
37 if (mMessages.isEmpty()) {
38 emitResult(OK);
39 return;
40 }
41 if (mDestFolder.isValid()) {
42 Akonadi::ItemMoveJob *job = new Akonadi::ItemMoveJob(mMessages, mDestFolder, this);
43 connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMoveResult(KJob*)));
44 } else {
45 Akonadi::ItemDeleteJob *job = new Akonadi::ItemDeleteJob(mMessages, this);
46 connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMoveResult(KJob*)));
47 }
48}
49
50void MoveCommand::slotMoveResult(KJob *job)
51{
52 if (job->error()) {
53 // handle errors
54 Util::showJobError(job);
55 emitResult(Failed);
56 } else {
57 emitResult(OK);
58 }
59}
60
61#include "moc_movecommand_p.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/kmime

Skip menu "akonadi/kmime"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 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