From c1eb4d6f95962c36e5e3994a0e6578cbff03cf49 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 25 Dec 2015 11:32:51 +0100 Subject: clear command --- akonadish/syntax_modules/akonadi_clear.cpp | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 akonadish/syntax_modules/akonadi_clear.cpp (limited to 'akonadish/syntax_modules/akonadi_clear.cpp') diff --git a/akonadish/syntax_modules/akonadi_clear.cpp b/akonadish/syntax_modules/akonadi_clear.cpp new file mode 100644 index 0000000..d17fac2 --- /dev/null +++ b/akonadish/syntax_modules/akonadi_clear.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2014 Aaron Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include // tr() +#include + +#include "common/resource.h" +#include "common/storage.h" +#include "common/domain/event.h" +#include "common/domain/folder.h" +#include "common/resourceconfig.h" +#include "common/log.h" +#include "common/storage.h" +#include "common/definitions.h" + +#include "akonadish_utils.h" +#include "state.h" +#include "syntaxtree.h" + +namespace AkonadiClear +{ + +bool clear(const QStringList &args, State &state) +{ + for (const auto &resource : args) { + state.print(QObject::tr("Removing local cache for '%1' ...").arg(resource)); + Akonadi2::Store::removeFromDisk(resource.toLatin1()); + state.printLine(QObject::tr("done")); + } + + return true; +} + +Syntax::List syntax() +{ + Syntax::List syntax; + syntax << Syntax("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &AkonadiClear::clear); + + return syntax; +} + +REGISTER_SYNTAX(AkonadiClear) + +} -- cgit v1.2.3