Diffstat (limited to 'noncore/apps/opie-console/script.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/script.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp new file mode 100644 index 0000000..a09fab6 --- a/dev/null +++ b/noncore/apps/opie-console/script.cpp | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qtextstream.h> | ||
3 | #include "script.h" | ||
4 | |||
5 | Script::Script() { | ||
6 | } | ||
7 | |||
8 | Script::Script(const QString fileName) { | ||
9 | QFile file(fileName); | ||
10 | QTextStream stream(&file); | ||
11 | while (!stream.atEnd()) { | ||
12 | appendString(stream.readLine()); | ||
13 | } | ||
14 | } | ||
15 | |||
16 | void Script::saveTo(const QString fileName) const { | ||
17 | QFile file(fileName); | ||
18 | file.open(IO_WriteOnly); | ||
19 | file.writeBlock(m_script.ascii(), m_script.length()); | ||
20 | file.close(); | ||
21 | } | ||
22 | |||
23 | |||
24 | void Script::appendString(const QString string) { | ||
25 | m_script += string; | ||
26 | } | ||
27 | |||
28 | QString Script::script() const { | ||
29 | return m_script; | ||
30 | } | ||