summaryrefslogtreecommitdiffstats
path: root/akonadi2_cli/state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'akonadi2_cli/state.cpp')
-rw-r--r--akonadi2_cli/state.cpp16
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
30void State::print(const QString &message) 30void 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
35void State::printLine(const QString &message) 39void 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
40void State::printError(const QString &error, int code) 46void 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}