From a4d438b7f5780e865c824f6e7f892bb3f0ee2b61 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Wed, 23 Dec 2015 12:00:00 +0100 Subject: help now uses State to push out output --- akonadi2_cli/state.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'akonadi2_cli/state.cpp') 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() { } -void State::print(const QString &message) +void State::print(const QString &message, unsigned int indentationLevel) { + for (unsigned int i = 0; i < indentationLevel; ++i) { + m_outStream << "\t"; + } + m_outStream << message; } -void State::printLine(const QString &message) +void State::printLine(const QString &message, unsigned int indentationLevel) { - m_outStream << message << "\n"; + print(message, indentationLevel); + m_outStream << "\n"; + m_outStream.flush(); } -void State::printError(const QString &error, int code) +void State::printError(const QString &errorMessage, const QString &errorCode) { - m_outStream << "ERROR " << code << ": " << error << "\n"; + printLine("ERROR" + (errorCode.isEmpty() ? "" : " " + errorCode) + ": " + errorMessage); } -- cgit v1.2.3