[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [akonadi-next/feature/new_cli] akonadish: clear command
From:       Aaron Seigo <aseigo () kde ! org>
Date:       2015-12-25 10:37:35
Message-ID: E1aCPkd-0005Ec-FQ () scm ! kde ! org
[Download RAW message or body]

Git commit c1eb4d6f95962c36e5e3994a0e6578cbff03cf49 by Aaron Seigo.
Committed on 25/12/2015 at 10:32.
Pushed by aseigo into branch 'feature/new_cli'.

clear command

M  +1    -0    akonadish/CMakeLists.txt
A  +61   -0    akonadish/syntax_modules/akonadi_clear.cpp     [License: GPL=
 (v2+)]

http://commits.kde.org/akonadi-next/c1eb4d6f95962c36e5e3994a0e6578cbff03cf49

diff --git a/akonadish/CMakeLists.txt b/akonadish/CMakeLists.txt
index 39a059f..e00d25a 100644
--- a/akonadish/CMakeLists.txt
+++ b/akonadish/CMakeLists.txt
@@ -8,6 +8,7 @@ set(akonadi2_cli_SRCS
     syntaxtree.cpp
     syntax_modules/core_syntax.cpp
     syntax_modules/akonadi_list.cpp
+    syntax_modules/akonadi_clear.cpp
     syntax_modules/akonadi_count.cpp
     syntax_modules/akonadi_sync.cpp
     akonadish_utils.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 <aseigo@kde.org>
+ *
+ *   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 <QDebug>
+#include <QObject> // tr()
+#include <QTimer>
+
+#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(r=
esource));
+        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 o=
r more resources (be careful!)"), &AkonadiClear::clear);
+
+    return syntax;
+}
+
+REGISTER_SYNTAX(AkonadiClear)
+
+}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic