-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 02f8451..b143361 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -216,98 +216,102 @@ void MainWindow::slotNew() { | |||
216 | ProfileEditorDialog dlg(factory() ); | 216 | ProfileEditorDialog dlg(factory() ); |
217 | dlg.showMaximized(); | 217 | dlg.showMaximized(); |
218 | int ret = dlg.exec(); | 218 | int ret = dlg.exec(); |
219 | 219 | ||
220 | if ( ret == QDialog::Accepted ) { | 220 | if ( ret == QDialog::Accepted ) { |
221 | create( dlg.profile() ); | 221 | create( dlg.profile() ); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | void MainWindow::slotRecordScript() { | 225 | void MainWindow::slotRecordScript() { |
226 | /* if (currentSession()) { | 226 | /* if (currentSession()) { |
227 | currentSession()->emulationLayer()->startRecording(); | 227 | currentSession()->emulationLayer()->startRecording(); |
228 | } | 228 | } |
229 | */ | 229 | */ |
230 | } | 230 | } |
231 | 231 | ||
232 | void MainWindow::slotSaveScript() { | 232 | void MainWindow::slotSaveScript() { |
233 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 233 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
234 | MimeTypes types; | 234 | MimeTypes types; |
235 | QStringList script; | 235 | QStringList script; |
236 | script << "text/plain"; | 236 | script << "text/plain"; |
237 | types.insert("Script", script); | 237 | types.insert("Script", script); |
238 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 238 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
239 | if (!filename.isEmpty()) { | 239 | if (!filename.isEmpty()) { |
240 | currentSession()->emulationLayer()->script()->saveTo(filename); | 240 | currentSession()->emulationLayer()->script()->saveTo(filename); |
241 | currentSession()->emulationLayer()->clearScript(); | 241 | currentSession()->emulationLayer()->clearScript(); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | */ | 244 | */ |
245 | } | 245 | } |
246 | 246 | ||
247 | void MainWindow::slotRunScript() { | 247 | void MainWindow::slotRunScript() { |
248 | /* | 248 | /* |
249 | if (currentSession()) { | 249 | if (currentSession()) { |
250 | MimeTypes types; | 250 | MimeTypes types; |
251 | QStringList script; | 251 | QStringList script; |
252 | script << "text/plain"; | 252 | script << "text/plain"; |
253 | types.insert("Script", script); | 253 | types.insert("Script", script); |
254 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 254 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
255 | if (!filename.isEmpty()) { | 255 | if (!filename.isEmpty()) { |
256 | Script script(DocLnk(filename).file()); | 256 | Script script(DocLnk(filename).file()); |
257 | currentSession()->emulationLayer()->runScript(&script); | 257 | currentSession()->emulationLayer()->runScript(&script); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | */ | 260 | */ |
261 | } | 261 | } |
262 | 262 | ||
263 | void MainWindow::slotConnect() { | 263 | void MainWindow::slotConnect() { |
264 | if ( currentSession() ) | 264 | if ( currentSession() ) { |
265 | currentSession()->layer()->open(); | 265 | bool ret = currentSession()->layer()->open(); |
266 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | ||
267 | QObject::tr("Failed"), | ||
268 | QObject::tr("Connecting failed for this session.")); | ||
269 | } | ||
266 | } | 270 | } |
267 | 271 | ||
268 | void MainWindow::slotDisconnect() { | 272 | void MainWindow::slotDisconnect() { |
269 | if ( currentSession() ) | 273 | if ( currentSession() ) |
270 | currentSession()->layer()->close(); | 274 | currentSession()->layer()->close(); |
271 | } | 275 | } |
272 | 276 | ||
273 | void MainWindow::slotTerminate() { | 277 | void MainWindow::slotTerminate() { |
274 | if ( currentSession() ) | 278 | if ( currentSession() ) |
275 | currentSession()->layer()->close(); | 279 | currentSession()->layer()->close(); |
276 | 280 | ||
277 | slotClose(); | 281 | slotClose(); |
278 | /* FIXME move to the next session */ | 282 | /* FIXME move to the next session */ |
279 | } | 283 | } |
280 | 284 | ||
281 | void MainWindow::slotConfigure() { | 285 | void MainWindow::slotConfigure() { |
282 | qWarning("configure"); | 286 | qWarning("configure"); |
283 | ConfigDialog conf( manager()->all(), factory() ); | 287 | ConfigDialog conf( manager()->all(), factory() ); |
284 | conf.showMaximized(); | 288 | conf.showMaximized(); |
285 | 289 | ||
286 | int ret = conf.exec(); | 290 | int ret = conf.exec(); |
287 | 291 | ||
288 | if ( QDialog::Accepted == ret ) { | 292 | if ( QDialog::Accepted == ret ) { |
289 | qWarning("conf %d", conf.list().count() ); | 293 | qWarning("conf %d", conf.list().count() ); |
290 | manager()->setProfiles( conf.list() ); | 294 | manager()->setProfiles( conf.list() ); |
291 | manager()->save(); | 295 | manager()->save(); |
292 | populateProfiles(); | 296 | populateProfiles(); |
293 | } | 297 | } |
294 | } | 298 | } |
295 | /* | 299 | /* |
296 | * we will remove | 300 | * we will remove |
297 | * this window from the tabwidget | 301 | * this window from the tabwidget |
298 | * remove it from the list | 302 | * remove it from the list |
299 | * delete it | 303 | * delete it |
300 | * and set the currentSession() | 304 | * and set the currentSession() |
301 | */ | 305 | */ |
302 | void MainWindow::slotClose() { | 306 | void MainWindow::slotClose() { |
303 | qWarning("close"); | 307 | qWarning("close"); |
304 | if (!currentSession() ) | 308 | if (!currentSession() ) |
305 | return; | 309 | return; |
306 | 310 | ||
307 | tabWidget()->remove( currentSession() ); | 311 | tabWidget()->remove( currentSession() ); |
308 | /*it's autodelete */ | 312 | /*it's autodelete */ |
309 | m_sessions.remove( m_curSession ); | 313 | m_sessions.remove( m_curSession ); |
310 | m_curSession = m_sessions.first(); | 314 | m_curSession = m_sessions.first(); |
311 | tabWidget()->setCurrent( m_curSession ); | 315 | tabWidget()->setCurrent( m_curSession ); |
312 | } | 316 | } |
313 | 317 | ||