diff options
Diffstat (limited to 'akonadish/syntax_modules')
-rw-r--r-- | akonadish/syntax_modules/akonadi_count.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_list.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_stat.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_sync.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/core_syntax.cpp | 26 |
5 files changed, 26 insertions, 8 deletions
diff --git a/akonadish/syntax_modules/akonadi_count.cpp b/akonadish/syntax_modules/akonadi_count.cpp index 5acdcdd..bb1cd19 100644 --- a/akonadish/syntax_modules/akonadi_count.cpp +++ b/akonadish/syntax_modules/akonadi_count.cpp | |||
@@ -53,8 +53,6 @@ bool count(const QStringList &args, State &state) | |||
53 | for (const auto &res : resources) { | 53 | for (const auto &res : resources) { |
54 | query.resources << res.toLatin1(); | 54 | query.resources << res.toLatin1(); |
55 | } | 55 | } |
56 | query.syncOnDemand = false; | ||
57 | query.processAll = false; | ||
58 | query.liveQuery = false; | 56 | query.liveQuery = false; |
59 | 57 | ||
60 | auto model = AkonadishUtils::loadModel(type, query); | 58 | auto model = AkonadishUtils::loadModel(type, query); |
diff --git a/akonadish/syntax_modules/akonadi_list.cpp b/akonadish/syntax_modules/akonadi_list.cpp index 82f13b5..7709d3b 100644 --- a/akonadish/syntax_modules/akonadi_list.cpp +++ b/akonadish/syntax_modules/akonadi_list.cpp | |||
@@ -58,8 +58,6 @@ bool list(const QStringList &args, State &state) | |||
58 | for (const auto &res : resources) { | 58 | for (const auto &res : resources) { |
59 | query.resources << res.toLatin1(); | 59 | query.resources << res.toLatin1(); |
60 | } | 60 | } |
61 | query.syncOnDemand = false; | ||
62 | query.processAll = false; | ||
63 | query.liveQuery = false; | 61 | query.liveQuery = false; |
64 | 62 | ||
65 | QTime time; | 63 | QTime time; |
diff --git a/akonadish/syntax_modules/akonadi_stat.cpp b/akonadish/syntax_modules/akonadi_stat.cpp index 9270f9d..d10556f 100644 --- a/akonadish/syntax_modules/akonadi_stat.cpp +++ b/akonadish/syntax_modules/akonadi_stat.cpp | |||
@@ -69,8 +69,6 @@ void statResources(const QStringList &resources, const State &state) | |||
69 | bool statAllResources(State &state) | 69 | bool statAllResources(State &state) |
70 | { | 70 | { |
71 | Akonadi2::Query query; | 71 | Akonadi2::Query query; |
72 | query.syncOnDemand = false; | ||
73 | query.processAll = false; | ||
74 | query.liveQuery = false; | 72 | query.liveQuery = false; |
75 | auto model = AkonadishUtils::loadModel("resource", query); | 73 | auto model = AkonadishUtils::loadModel("resource", query); |
76 | 74 | ||
diff --git a/akonadish/syntax_modules/akonadi_sync.cpp b/akonadish/syntax_modules/akonadi_sync.cpp index 03abbb4..0c994d0 100644 --- a/akonadish/syntax_modules/akonadi_sync.cpp +++ b/akonadish/syntax_modules/akonadi_sync.cpp | |||
@@ -43,8 +43,6 @@ bool sync(const QStringList &args, State &state) | |||
43 | for (const auto &res : args) { | 43 | for (const auto &res : args) { |
44 | query.resources << res.toLatin1(); | 44 | query.resources << res.toLatin1(); |
45 | } | 45 | } |
46 | query.syncOnDemand = true; | ||
47 | query.processAll = true; | ||
48 | 46 | ||
49 | QTimer::singleShot(0, [query, state]() { | 47 | QTimer::singleShot(0, [query, state]() { |
50 | Akonadi2::Store::synchronize(query).then<void>([state]() { | 48 | Akonadi2::Store::synchronize(query).then<void>([state]() { |
diff --git a/akonadish/syntax_modules/core_syntax.cpp b/akonadish/syntax_modules/core_syntax.cpp index b4812df..ccf96c1 100644 --- a/akonadish/syntax_modules/core_syntax.cpp +++ b/akonadish/syntax_modules/core_syntax.cpp | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include "state.h" | 25 | #include "state.h" |
26 | #include "syntaxtree.h" | 26 | #include "syntaxtree.h" |
27 | #include "utils.h" | ||
27 | 28 | ||
28 | namespace CoreSyntax | 29 | namespace CoreSyntax |
29 | { | 30 | { |
@@ -145,6 +146,24 @@ bool printSyntaxTree(const QStringList &, State &state) | |||
145 | return true; | 146 | return true; |
146 | } | 147 | } |
147 | 148 | ||
149 | bool setLoggingLevel(const QStringList &commands, State &state) | ||
150 | { | ||
151 | if (commands.count() != 1) { | ||
152 | state.printError(QObject::tr("Wrong number of arguments; expected 1 got %1").arg(commands.count())); | ||
153 | return false; | ||
154 | } | ||
155 | |||
156 | state.setLoggingLevel(commands.at(0)); | ||
157 | return true; | ||
158 | } | ||
159 | |||
160 | bool printLoggingLevel(const QStringList &commands, State &state) | ||
161 | { | ||
162 | const QString level = state.loggingLevel(); | ||
163 | state.printLine(level); | ||
164 | return true; | ||
165 | } | ||
166 | |||
148 | Syntax::List syntax() | 167 | Syntax::List syntax() |
149 | { | 168 | { |
150 | Syntax::List syntax; | 169 | Syntax::List syntax; |
@@ -158,15 +177,22 @@ Syntax::List syntax() | |||
158 | 177 | ||
159 | Syntax set("set", QObject::tr("Sets settings for the session")); | 178 | Syntax set("set", QObject::tr("Sets settings for the session")); |
160 | set.children << Syntax("debug", QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel); | 179 | set.children << Syntax("debug", QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel); |
180 | |||
161 | Syntax setTiming = Syntax("timing", QObject::tr("Whether or not to print the time commands take to complete")); | 181 | Syntax setTiming = Syntax("timing", QObject::tr("Whether or not to print the time commands take to complete")); |
162 | setTiming.children << Syntax("on", QString(), [](const QStringList &, State &state) -> bool { state.setCommandTiming(true); return true; }); | 182 | setTiming.children << Syntax("on", QString(), [](const QStringList &, State &state) -> bool { state.setCommandTiming(true); return true; }); |
163 | setTiming.children << Syntax("off", QString(), [](const QStringList &, State &state) -> bool { state.setCommandTiming(false); return true; }); | 183 | setTiming.children << Syntax("off", QString(), [](const QStringList &, State &state) -> bool { state.setCommandTiming(false); return true; }); |
164 | set.children << setTiming; | 184 | set.children << setTiming; |
185 | |||
186 | Syntax logging("logging", QObject::tr("Set the logging level to one of Trace, Log, Warning or Error"), &CoreSyntax::setLoggingLevel); | ||
187 | logging.completer = [](const QStringList &, const QString &fragment, State &state) -> QStringList { return Utils::filteredCompletions(QStringList() << "trace" << "log" << "warning" << "error", fragment, Qt::CaseInsensitive); }; | ||
188 | set.children << logging; | ||
189 | |||
165 | syntax << set; | 190 | syntax << set; |
166 | 191 | ||
167 | Syntax get("get", QObject::tr("Gets settings for the session")); | 192 | Syntax get("get", QObject::tr("Gets settings for the session")); |
168 | get.children << Syntax("debug", QObject::tr("The current debug level from 0 to 6"), &CoreSyntax::printDebugLevel); | 193 | get.children << Syntax("debug", QObject::tr("The current debug level from 0 to 6"), &CoreSyntax::printDebugLevel); |
169 | get.children << Syntax("timing", QObject::tr("Whether or not to print the time commands take to complete"), &CoreSyntax::printCommandTiming); | 194 | get.children << Syntax("timing", QObject::tr("Whether or not to print the time commands take to complete"), &CoreSyntax::printCommandTiming); |
195 | get.children << Syntax("logging", QObject::tr("The current logging level"), &CoreSyntax::printLoggingLevel); | ||
170 | syntax << get; | 196 | syntax << get; |
171 | 197 | ||
172 | return syntax; | 198 | return syntax; |