summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_sync.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-20 19:07:07 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-20 19:07:07 +0100
commitbdb01c2c068df326f5a8328ed1492ab1bea388c5 (patch)
tree25c2ee1b29bc481b6914c244ed9ca194b1415d16 /sinksh/syntax_modules/sink_sync.cpp
parent17e7ee40c9185c0505883853345fd6024c675b1a (diff)
downloadsink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.tar.gz
sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.zip
Renamed Akonadi2 to Sink
(except for documentation).
Diffstat (limited to 'sinksh/syntax_modules/sink_sync.cpp')
-rw-r--r--sinksh/syntax_modules/sink_sync.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/sinksh/syntax_modules/sink_sync.cpp b/sinksh/syntax_modules/sink_sync.cpp
new file mode 100644
index 0000000..3006202
--- /dev/null
+++ b/sinksh/syntax_modules/sink_sync.cpp
@@ -0,0 +1,67 @@
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 "sinksh_utils.h"
34#include "state.h"
35#include "syntaxtree.h"
36
37namespace SinkSync
38{
39
40bool sync(const QStringList &args, State &state)
41{
42 Sink::Query query;
43 for (const auto &res : args) {
44 query.resources << res.toLatin1();
45 }
46
47 QTimer::singleShot(0, [query, state]() {
48 Sink::Store::synchronize(query).then<void>([state]() {
49 state.printLine("Synchronization complete!");
50 state.commandFinished();
51 }).exec();
52 });
53
54 return true;
55}
56
57Syntax::List syntax()
58{
59 Syntax sync("sync", QObject::tr("Syncronizes all resources that are listed; and empty list triggers a syncronizaton on all resources"), &SinkSync::sync, Syntax::EventDriven );
60 sync.completer = &SinkshUtils::resourceCompleter;
61
62 return Syntax::List() << sync;
63}
64
65REGISTER_SYNTAX(SinkSync)
66
67}