diff options
author | Aaron Seigo <aseigo@kde.org> | 2015-12-25 11:32:51 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2015-12-25 11:32:51 +0100 |
commit | c1eb4d6f95962c36e5e3994a0e6578cbff03cf49 (patch) | |
tree | f22763e3fea0c1826015200730e35ac37afc5335 /akonadish/syntax_modules/akonadi_clear.cpp | |
parent | 5722805a3f6aa144c5b47dc47f16cd21c057bbd6 (diff) | |
download | sink-c1eb4d6f95962c36e5e3994a0e6578cbff03cf49.tar.gz sink-c1eb4d6f95962c36e5e3994a0e6578cbff03cf49.zip |
clear command
Diffstat (limited to 'akonadish/syntax_modules/akonadi_clear.cpp')
-rw-r--r-- | akonadish/syntax_modules/akonadi_clear.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
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 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | |||
20 | #include <QDebug> | ||
21 | #include <QObject> // tr() | ||
22 | #include <QTimer> | ||
23 | |||
24 | #include "common/resource.h" | ||
25 | #include "common/storage.h" | ||
26 | #include "common/domain/event.h" | ||
27 | #include "common/domain/folder.h" | ||
28 | #include "common/resourceconfig.h" | ||
29 | #include "common/log.h" | ||
30 | #include "common/storage.h" | ||
31 | #include "common/definitions.h" | ||
32 | |||
33 | #include "akonadish_utils.h" | ||
34 | #include "state.h" | ||
35 | #include "syntaxtree.h" | ||
36 | |||
37 | namespace AkonadiClear | ||
38 | { | ||
39 | |||
40 | bool clear(const QStringList &args, State &state) | ||
41 | { | ||
42 | for (const auto &resource : args) { | ||
43 | state.print(QObject::tr("Removing local cache for '%1' ...").arg(resource)); | ||
44 | Akonadi2::Store::removeFromDisk(resource.toLatin1()); | ||
45 | state.printLine(QObject::tr("done")); | ||
46 | } | ||
47 | |||
48 | return true; | ||
49 | } | ||
50 | |||
51 | Syntax::List syntax() | ||
52 | { | ||
53 | Syntax::List syntax; | ||
54 | syntax << Syntax("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &AkonadiClear::clear); | ||
55 | |||
56 | return syntax; | ||
57 | } | ||
58 | |||
59 | REGISTER_SYNTAX(AkonadiClear) | ||
60 | |||
61 | } | ||