File indexing completed on 2024-05-12 05:12:42

0001 /*
0002     Copyright (C) 2013  Jonathan Marten <jjm@keelhaul.me.uk>
0003 
0004     This program is free software; you can redistribute it and/or modify
0005     it under the terms of the GNU General Public License as published by
0006     the Free Software Foundation; either version 2 of the License, or
0007     (at your option) any later version.
0008 
0009     This program is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012     GNU General Public License for more details.
0013 
0014     You should have received a copy of the GNU General Public License along
0015     with this program; if not, write to the Free Software Foundation, Inc.,
0016     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0017 */
0018 
0019 #include "movecommand.h"
0020 
0021 #include "errorreporter.h"
0022 
0023 #include "commandfactory.h"
0024 
0025 using namespace Akonadi;
0026 
0027 DEFINE_COMMAND("move", MoveCommand, I18N_NOOP("Move collections or items into a new collection"));
0028 
0029 MoveCommand::MoveCommand(QObject *parent)
0030     : CopyCommand(parent)
0031 {
0032     mMoving = true;
0033 }
0034 
0035 void MoveCommand::setupCommandOptions(QCommandLineParser *parser)
0036 {
0037     addOptionsOption(parser);
0038     addDryRunOption(parser);
0039 
0040     parser->addPositionalArgument("source", i18nc("@info:shell", "Existing collections or items to move"), i18n("source..."));
0041     parser->addPositionalArgument("destination", i18nc("@info:shell", "Destination collection to move into"));
0042 }
0043 
0044 void MoveCommand::start()
0045 {
0046     if (!allowDangerousOperation()) {
0047         emit finished(RuntimeError);
0048     }
0049     CopyCommand::start();
0050 }