summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 7ffeca7..89f3516 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -252,111 +252,113 @@ TabWidget* MainWindow::tabWidget() {
252} 252}
253void MainWindow::populateProfiles() { 253void MainWindow::populateProfiles() {
254 m_sessionsPop->clear(); 254 m_sessionsPop->clear();
255 Profile::ValueList list = manager()->all(); 255 Profile::ValueList list = manager()->all();
256 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 256 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
257 m_sessionsPop->insertItem( (*it).name() ); 257 m_sessionsPop->insertItem( (*it).name() );
258 } 258 }
259 259
260} 260}
261MainWindow::~MainWindow() { 261MainWindow::~MainWindow() {
262 delete m_factory; 262 delete m_factory;
263 manager()->save(); 263 manager()->save();
264} 264}
265 265
266MetaFactory* MainWindow::factory() { 266MetaFactory* MainWindow::factory() {
267 return m_factory; 267 return m_factory;
268} 268}
269 269
270Session* MainWindow::currentSession() { 270Session* MainWindow::currentSession() {
271 return m_curSession; 271 return m_curSession;
272} 272}
273 273
274QList<Session> MainWindow::sessions() { 274QList<Session> MainWindow::sessions() {
275 return m_sessions; 275 return m_sessions;
276} 276}
277 277
278void MainWindow::slotNew() { 278void MainWindow::slotNew() {
279 ProfileEditorDialog dlg(factory() ); 279 ProfileEditorDialog dlg(factory() );
280 dlg.showMaximized(); 280 dlg.showMaximized();
281 int ret = dlg.exec(); 281 int ret = dlg.exec();
282 282
283 if ( ret == QDialog::Accepted ) { 283 if ( ret == QDialog::Accepted ) {
284 create( dlg.profile() ); 284 create( dlg.profile() );
285 } 285 }
286} 286}
287 287
288void MainWindow::slotRecordScript() { 288void MainWindow::slotRecordScript() {
289 if (currentSession()) { 289 if (currentSession()) {
290 currentSession()->emulationHandler()->startRecording(); 290 currentSession()->emulationHandler()->startRecording();
291 } 291 }
292} 292}
293 293
294void MainWindow::slotSaveScript() { 294void 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 script << "text/all";
300 script << "application/octet-stream";
300 types.insert("Script", script); 301 types.insert("Script", script);
301 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 302 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
302 if (!filename.isEmpty()) { 303 if (!filename.isEmpty()) {
303 currentSession()->emulationHandler()->script()->saveTo(filename); 304 currentSession()->emulationHandler()->script()->saveTo(filename);
304 currentSession()->emulationHandler()->clearScript(); 305 currentSession()->emulationHandler()->clearScript();
305 } 306 }
306 } 307 }
307} 308}
308 309
309void MainWindow::slotRunScript() { 310void MainWindow::slotRunScript() {
310 if (currentSession()) { 311 if (currentSession()) {
311 MimeTypes types; 312 MimeTypes types;
312 QStringList script; 313 QStringList script;
313 script << "text/plain"; 314 script << "text/plain";
314 script << "text/all"; 315 script << "text/all";
316 script << "application/octet-stream";
315 types.insert("Script", script); 317 types.insert("Script", script);
316 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 318 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
317 if (!filename.isEmpty()) { 319 if (!filename.isEmpty()) {
318 Script script(DocLnk(filename).file()); 320 Script script(DocLnk(filename).file());
319 currentSession()->emulationHandler()->runScript(&script); 321 currentSession()->emulationHandler()->runScript(&script);
320 } 322 }
321 } 323 }
322} 324}
323 325
324void MainWindow::slotConnect() { 326void MainWindow::slotConnect() {
325 if ( currentSession() ) { 327 if ( currentSession() ) {
326 bool ret = currentSession()->layer()->open(); 328 bool ret = currentSession()->layer()->open();
327 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 329 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
328 QObject::tr("Failed"), 330 QObject::tr("Failed"),
329 QObject::tr("Connecting failed for this session.")); 331 QObject::tr("Connecting failed for this session."));
330 else { 332 else {
331 m_connect->setEnabled( false ); 333 m_connect->setEnabled( false );
332 m_disconnect->setEnabled( true ); 334 m_disconnect->setEnabled( true );
333 } 335 }
334 } 336 }
335} 337}
336 338
337void MainWindow::slotDisconnect() { 339void MainWindow::slotDisconnect() {
338 if ( currentSession() ) { 340 if ( currentSession() ) {
339 currentSession()->layer()->close(); 341 currentSession()->layer()->close();
340 m_connect->setEnabled( true ); 342 m_connect->setEnabled( true );
341 m_disconnect->setEnabled( false ); 343 m_disconnect->setEnabled( false );
342 } 344 }
343} 345}
344 346
345void MainWindow::slotTerminate() { 347void MainWindow::slotTerminate() {
346 if ( currentSession() ) 348 if ( currentSession() )
347 currentSession()->layer()->close(); 349 currentSession()->layer()->close();
348 350
349 slotClose(); 351 slotClose();
350 /* FIXME move to the next session */ 352 /* FIXME move to the next session */
351} 353}
352 354
353void MainWindow::slotConfigure() { 355void MainWindow::slotConfigure() {
354 ConfigDialog conf( manager()->all(), factory() ); 356 ConfigDialog conf( manager()->all(), factory() );
355 conf.showMaximized(); 357 conf.showMaximized();
356 358
357 int ret = conf.exec(); 359 int ret = conf.exec();
358 360
359 if ( QDialog::Accepted == ret ) { 361 if ( QDialog::Accepted == ret ) {
360 manager()->setProfiles( conf.list() ); 362 manager()->setProfiles( conf.list() );
361 manager()->save(); 363 manager()->save();
362 populateProfiles(); 364 populateProfiles();