Diffstat (limited to 'noncore/apps/opie-console/script.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/script.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp index a09fab6..9cb1cd3 100644 --- a/noncore/apps/opie-console/script.cpp +++ b/noncore/apps/opie-console/script.cpp @@ -9,6 +9,3 @@ Script::Script(const QString fileName) { QFile file(fileName); - QTextStream stream(&file); - while (!stream.atEnd()) { - appendString(stream.readLine()); - } + m_script = file.readAll(); } @@ -18,3 +15,3 @@ void Script::saveTo(const QString fileName) const { file.open(IO_WriteOnly); - file.writeBlock(m_script.ascii(), m_script.length()); + file.writeBlock(m_script); file.close(); @@ -23,7 +20,9 @@ void Script::saveTo(const QString fileName) const { -void Script::appendString(const QString string) { - m_script += string; +void Script::append(const QByteArray &data) { + int size = m_script.size(); + m_script.resize(size + data.size()); + memcpy(m_script.data() + size, data.data(), data.size()); } -QString Script::script() const { +QByteArray Script::script() const { return m_script; |