diff options
author | Aaron Seigo <aseigo@kde.org> | 2015-12-23 12:00:00 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2015-12-23 12:00:00 +0100 |
commit | a4d438b7f5780e865c824f6e7f892bb3f0ee2b61 (patch) | |
tree | 622374f9628b8a0113ce40eaa3bc1eb0e604a80a /akonadi2_cli/state.cpp | |
parent | 6f720eaf111826a1588b37870bf1af638b1420a0 (diff) | |
download | sink-a4d438b7f5780e865c824f6e7f892bb3f0ee2b61.tar.gz sink-a4d438b7f5780e865c824f6e7f892bb3f0ee2b61.zip |
help now uses State to push out output
Diffstat (limited to 'akonadi2_cli/state.cpp')
-rw-r--r-- | akonadi2_cli/state.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/akonadi2_cli/state.cpp b/akonadi2_cli/state.cpp index 80a2d3a..9beba7e 100644 --- a/akonadi2_cli/state.cpp +++ b/akonadi2_cli/state.cpp | |||
@@ -27,17 +27,23 @@ State::State() | |||
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | void State::print(const QString &message) | 30 | void State::print(const QString &message, unsigned int indentationLevel) |
31 | { | 31 | { |
32 | for (unsigned int i = 0; i < indentationLevel; ++i) { | ||
33 | m_outStream << "\t"; | ||
34 | } | ||
35 | |||
32 | m_outStream << message; | 36 | m_outStream << message; |
33 | } | 37 | } |
34 | 38 | ||
35 | void State::printLine(const QString &message) | 39 | void State::printLine(const QString &message, unsigned int indentationLevel) |
36 | { | 40 | { |
37 | m_outStream << message << "\n"; | 41 | print(message, indentationLevel); |
42 | m_outStream << "\n"; | ||
43 | m_outStream.flush(); | ||
38 | } | 44 | } |
39 | 45 | ||
40 | void State::printError(const QString &error, int code) | 46 | void State::printError(const QString &errorMessage, const QString &errorCode) |
41 | { | 47 | { |
42 | m_outStream << "ERROR " << code << ": " << error << "\n"; | 48 | printLine("ERROR" + (errorCode.isEmpty() ? "" : " " + errorCode) + ": " + errorMessage); |
43 | } | 49 | } |