Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 8f5d56b..46c5bed 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -7,3 +7,3 @@ | |||
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | #include <opie/ofiledialog.h> | |
9 | 9 | ||
@@ -19,2 +19,3 @@ | |||
19 | #include "function_keyboard.h" | 19 | #include "function_keyboard.h" |
20 | #include "script.h" | ||
20 | 21 | ||
@@ -40,2 +41,3 @@ void MainWindow::initUI() { | |||
40 | m_console = new QPopupMenu( this ); | 41 | m_console = new QPopupMenu( this ); |
42 | m_scripts = new QPopupMenu( this ); | ||
41 | m_sessionsPop= new QPopupMenu( this ); | 43 | m_sessionsPop= new QPopupMenu( this ); |
@@ -108,2 +110,17 @@ void MainWindow::initUI() { | |||
108 | /* | 110 | /* |
111 | * script actions | ||
112 | */ | ||
113 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | ||
114 | m_recordScript->addTo(m_scripts); | ||
115 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | ||
116 | |||
117 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | ||
118 | m_saveScript->addTo(m_scripts); | ||
119 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | ||
120 | |||
121 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | ||
122 | m_runScript->addTo(m_scripts); | ||
123 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | ||
124 | |||
125 | /* | ||
109 | * action that open/closes the keyboard | 126 | * action that open/closes the keyboard |
@@ -128,2 +145,5 @@ void MainWindow::initUI() { | |||
128 | 145 | ||
146 | /* the scripts menu */ | ||
147 | m_bar->insertItem( tr("Scripts"), m_scripts ); | ||
148 | |||
129 | /* the settings menu */ | 149 | /* the settings menu */ |
@@ -191,2 +211,36 @@ void MainWindow::slotNew() { | |||
191 | 211 | ||
212 | void MainWindow::slotRecordScript() { | ||
213 | if (currentSession()) { | ||
214 | currentSession()->emulationLayer()->startRecording(); | ||
215 | } | ||
216 | } | ||
217 | |||
218 | void MainWindow::slotSaveScript() { | ||
219 | if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | ||
220 | MimeTypes types; | ||
221 | QStringList script; | ||
222 | script << "text/plain"; | ||
223 | types.insert("Script", script); | ||
224 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | ||
225 | if (!filename.isEmpty()) { | ||
226 | currentSession()->emulationLayer()->script()->saveTo(filename); | ||
227 | currentSession()->emulationLayer()->clearScript(); | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | |||
232 | void MainWindow::slotRunScript() { | ||
233 | if (currentSession()) { | ||
234 | MimeTypes types; | ||
235 | QStringList script; | ||
236 | script << "text/plain"; | ||
237 | types.insert("Script", script); | ||
238 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | ||
239 | if (!filename.isEmpty()) { | ||
240 | Script script(DocLnk(filename).file()); | ||
241 | currentSession()->emulationLayer()->runScript(&script); | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | |||
192 | void MainWindow::slotConnect() { | 246 | void MainWindow::slotConnect() { |