diff options
Diffstat (limited to 'akonadish/repl/repl.cpp')
-rw-r--r-- | akonadish/repl/repl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/akonadish/repl/repl.cpp b/akonadish/repl/repl.cpp index 395661e..499a4af 100644 --- a/akonadish/repl/repl.cpp +++ b/akonadish/repl/repl.cpp | |||
@@ -25,8 +25,10 @@ | |||
25 | #include <QFile> | 25 | #include <QFile> |
26 | #include <QFinalState> | 26 | #include <QFinalState> |
27 | #include <QStandardPaths> | 27 | #include <QStandardPaths> |
28 | #include <QTextStream> | ||
28 | 29 | ||
29 | #include "replStates.h" | 30 | #include "replStates.h" |
31 | #include "syntaxtree.h" | ||
30 | 32 | ||
31 | Repl::Repl(QObject *parent) | 33 | Repl::Repl(QObject *parent) |
32 | : QStateMachine(parent) | 34 | : QStateMachine(parent) |
@@ -56,6 +58,7 @@ Repl::Repl(QObject *parent) | |||
56 | print->addTransition(print, SIGNAL(completed()), eval); | 58 | print->addTransition(print, SIGNAL(completed()), eval); |
57 | 59 | ||
58 | setInitialState(read); | 60 | setInitialState(read); |
61 | printWelcomeBanner(); | ||
59 | start(); | 62 | start(); |
60 | } | 63 | } |
61 | 64 | ||
@@ -65,13 +68,23 @@ Repl::~Repl() | |||
65 | write_history(commandHistoryPath().toLocal8Bit()); | 68 | write_history(commandHistoryPath().toLocal8Bit()); |
66 | } | 69 | } |
67 | 70 | ||
71 | void Repl::printWelcomeBanner() | ||
72 | { | ||
73 | QTextStream out(stdout); | ||
74 | out << QObject::tr("Welcome to the Akonadi2 interative shell!\n"); | ||
75 | out << QObject::tr("Type `help` for information on the available commands.\n"); | ||
76 | out.flush(); | ||
77 | } | ||
78 | |||
68 | QString Repl::commandHistoryPath() | 79 | QString Repl::commandHistoryPath() |
69 | { | 80 | { |
70 | const QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation); | 81 | const QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation); |
82 | |||
71 | if (!QFile::exists(path)) { | 83 | if (!QFile::exists(path)) { |
72 | QDir dir; | 84 | QDir dir; |
73 | dir.mkpath(path); | 85 | dir.mkpath(path); |
74 | } | 86 | } |
87 | |||
75 | return path + "/repl_history"; | 88 | return path + "/repl_history"; |
76 | } | 89 | } |
77 | 90 | ||