-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/script.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index afac542..7ffeca7 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -293,12 +293,13 @@ void MainWindow::slotRecordScript() { | |||
293 | 293 | ||
294 | void MainWindow::slotSaveScript() { | 294 | void MainWindow::slotSaveScript() { |
295 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 295 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
296 | MimeTypes types; | 296 | MimeTypes types; |
297 | QStringList script; | 297 | QStringList script; |
298 | script << "text/plain"; | 298 | script << "text/plain"; |
299 | script << "text/all"; | ||
299 | types.insert("Script", script); | 300 | types.insert("Script", script); |
300 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 301 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
301 | if (!filename.isEmpty()) { | 302 | if (!filename.isEmpty()) { |
302 | currentSession()->emulationHandler()->script()->saveTo(filename); | 303 | currentSession()->emulationHandler()->script()->saveTo(filename); |
303 | currentSession()->emulationHandler()->clearScript(); | 304 | currentSession()->emulationHandler()->clearScript(); |
304 | } | 305 | } |
@@ -307,12 +308,13 @@ void MainWindow::slotSaveScript() { | |||
307 | 308 | ||
308 | void MainWindow::slotRunScript() { | 309 | void MainWindow::slotRunScript() { |
309 | if (currentSession()) { | 310 | if (currentSession()) { |
310 | MimeTypes types; | 311 | MimeTypes types; |
311 | QStringList script; | 312 | QStringList script; |
312 | script << "text/plain"; | 313 | script << "text/plain"; |
314 | script << "text/all"; | ||
313 | types.insert("Script", script); | 315 | types.insert("Script", script); |
314 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 316 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
315 | if (!filename.isEmpty()) { | 317 | if (!filename.isEmpty()) { |
316 | Script script(DocLnk(filename).file()); | 318 | Script script(DocLnk(filename).file()); |
317 | currentSession()->emulationHandler()->runScript(&script); | 319 | currentSession()->emulationHandler()->runScript(&script); |
318 | } | 320 | } |
diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp index 9cb1cd3..e6e9d6d 100644 --- a/noncore/apps/opie-console/script.cpp +++ b/noncore/apps/opie-console/script.cpp | |||
@@ -4,12 +4,13 @@ | |||
4 | 4 | ||
5 | Script::Script() { | 5 | Script::Script() { |
6 | } | 6 | } |
7 | 7 | ||
8 | Script::Script(const QString fileName) { | 8 | Script::Script(const QString fileName) { |
9 | QFile file(fileName); | 9 | QFile file(fileName); |
10 | file.open(IO_ReadOnly ); | ||
10 | m_script = file.readAll(); | 11 | m_script = file.readAll(); |
11 | } | 12 | } |
12 | 13 | ||
13 | void Script::saveTo(const QString fileName) const { | 14 | void Script::saveTo(const QString fileName) const { |
14 | QFile file(fileName); | 15 | QFile file(fileName); |
15 | file.open(IO_WriteOnly); | 16 | file.open(IO_WriteOnly); |