summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index c7750be..406586c 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -316,58 +316,64 @@ void MainWindow::slotRunScript() {
316 MimeTypes types; 316 MimeTypes types;
317 QStringList script; 317 QStringList script;
318 script << "text/plain"; 318 script << "text/plain";
319 script << "text/all"; 319 script << "text/all";
320 script << "application/octet-stream"; 320 script << "application/octet-stream";
321 types.insert("Script", script); 321 types.insert("Script", script);
322 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 322 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
323 if (!filename.isEmpty()) { 323 if (!filename.isEmpty()) {
324 Script script(DocLnk(filename).file()); 324 Script script(DocLnk(filename).file());
325 currentSession()->emulationHandler()->runScript(&script); 325 currentSession()->emulationHandler()->runScript(&script);
326 } 326 }
327 } 327 }
328} 328}
329 329
330void MainWindow::slotConnect() { 330void MainWindow::slotConnect() {
331 if ( currentSession() ) { 331 if ( currentSession() ) {
332 bool ret = currentSession()->layer()->open(); 332 bool ret = currentSession()->layer()->open();
333 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 333 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
334 QObject::tr("Failed"), 334 QObject::tr("Failed"),
335 QObject::tr("Connecting failed for this session.")); 335 QObject::tr("Connecting failed for this session."));
336 else { 336 else {
337 m_connect->setEnabled( false ); 337 m_connect->setEnabled( false );
338 m_disconnect->setEnabled( true ); 338 m_disconnect->setEnabled( true );
339 m_transfer->setEnabled( true ); 339 m_transfer->setEnabled( true );
340 m_recordScript->setEnabled( true );
341 m_saveScript->setEnabled( true );
342 m_runScript->setEnabled( true );
340 } 343 }
341 } 344 }
342} 345}
343 346
344void MainWindow::slotDisconnect() { 347void MainWindow::slotDisconnect() {
345 if ( currentSession() ) { 348 if ( currentSession() ) {
346 currentSession()->layer()->close(); 349 currentSession()->layer()->close();
347 m_connect->setEnabled( true ); 350 m_connect->setEnabled( true );
348 m_disconnect->setEnabled( false ); 351 m_disconnect->setEnabled( false );
349 m_transfer->setEnabled( false ); 352 m_transfer->setEnabled( false );
353 m_recordScript->setEnabled( false);
354 m_saveScript->setEnabled( false );
355 m_runScript->setEnabled( false );
350 } 356 }
351} 357}
352 358
353void MainWindow::slotTerminate() { 359void MainWindow::slotTerminate() {
354 if ( currentSession() ) 360 if ( currentSession() )
355 currentSession()->layer()->close(); 361 currentSession()->layer()->close();
356 362
357 slotClose(); 363 slotClose();
358 /* FIXME move to the next session */ 364 /* FIXME move to the next session */
359} 365}
360 366
361void MainWindow::slotConfigure() { 367void MainWindow::slotConfigure() {
362 ConfigDialog conf( manager()->all(), factory() ); 368 ConfigDialog conf( manager()->all(), factory() );
363 conf.showMaximized(); 369 conf.showMaximized();
364 370
365 int ret = conf.exec(); 371 int ret = conf.exec();
366 372
367 if ( QDialog::Accepted == ret ) { 373 if ( QDialog::Accepted == ret ) {
368 manager()->setProfiles( conf.list() ); 374 manager()->setProfiles( conf.list() );
369 manager()->save(); 375 manager()->save();
370 populateProfiles(); 376 populateProfiles();
371 } 377 }
372} 378}
373/* 379/*
@@ -412,54 +418,54 @@ void MainWindow::slotProfile( int id) {
412 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 418 Profile prof = manager()->profile( m_sessionsPop->text( id) );
413 create( prof ); 419 create( prof );
414} 420}
415void MainWindow::create( const Profile& prof ) { 421void MainWindow::create( const Profile& prof ) {
416 Session *ses = manager()->fromProfile( prof, tabWidget() ); 422 Session *ses = manager()->fromProfile( prof, tabWidget() );
417 423
418 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 424 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
419 { 425 {
420 QMessageBox::warning(this, 426 QMessageBox::warning(this,
421 QObject::tr("Session failed"), 427 QObject::tr("Session failed"),
422 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 428 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
423 //if(ses) delete ses; 429 //if(ses) delete ses;
424 return; 430 return;
425 } 431 }
426 432
427 m_sessions.append( ses ); 433 m_sessions.append( ses );
428 tabWidget()->add( ses ); 434 tabWidget()->add( ses );
429 tabWidget()->repaint(); 435 tabWidget()->repaint();
430 m_curSession = ses; 436 m_curSession = ses;
431 437
432 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 438 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
433 m_connect->setEnabled( true ); 439 m_connect->setEnabled( true );
434 m_disconnect->setEnabled( false ); 440 m_disconnect->setEnabled( false );
435 m_terminate->setEnabled( true ); 441 m_terminate->setEnabled( true );
436 m_recordScript->setEnabled( true );
437 m_saveScript->setEnabled( true );
438 m_runScript->setEnabled( true );
439 m_fullscreen->setEnabled( true ); 442 m_fullscreen->setEnabled( true );
440 m_closewindow->setEnabled( true ); 443 m_closewindow->setEnabled( true );
441 m_transfer->setEnabled( false ); 444 m_transfer->setEnabled( false );
445 m_recordScript->setEnabled( false );
446 m_saveScript->setEnabled( false );
447 m_runScript->setEnabled( false );
442 448
443 // is io_layer wants direct connection, then autoconnect 449 // is io_layer wants direct connection, then autoconnect
444 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 450 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
445 if (prof.autoConnect()) { 451 if (prof.autoConnect()) {
446 slotConnect(); 452 slotConnect();
447 } 453 }
448 454
449 455
450 456
451 QWidget *w = currentSession()->widget(); 457 QWidget *w = currentSession()->widget();
452 if(w) w->setFocus(); 458 if(w) w->setFocus();
453} 459}
454 460
455void MainWindow::slotTransfer() 461void MainWindow::slotTransfer()
456{ 462{
457 if ( currentSession() ) { 463 if ( currentSession() ) {
458 TransferDialog dlg(currentSession()->widgetStack(), this); 464 TransferDialog dlg(currentSession()->widgetStack(), this);
459 dlg.showMaximized(); 465 dlg.showMaximized();
460 //currentSession()->widgetStack()->add(dlg); 466 //currentSession()->widgetStack()->add(dlg);
461 dlg.exec(); 467 dlg.exec();
462 } 468 }
463} 469}
464 470
465 471
@@ -469,59 +475,69 @@ void MainWindow::slotOpenKeb(bool state) {
469 else m_keyBar->hide(); 475 else m_keyBar->hide();
470 476
471} 477}
472 478
473 479
474void MainWindow::slotOpenButtons( bool state ) { 480void MainWindow::slotOpenButtons( bool state ) {
475 481
476 if ( state ) { 482 if ( state ) {
477 m_buttonBar->show(); 483 m_buttonBar->show();
478 } else { 484 } else {
479 m_buttonBar->hide(); 485 m_buttonBar->hide();
480 } 486 }
481} 487}
482 488
483 489
484 490
485void MainWindow::slotSessionChanged( Session* ses ) { 491void MainWindow::slotSessionChanged( Session* ses ) {
486 qWarning("changed!"); 492 qWarning("changed!");
487 if ( ses ) { 493 if ( ses ) {
488 m_curSession = ses; 494 m_curSession = ses;
489 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 495 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
490 if ( m_curSession->layer()->isConnected() ) { 496 if ( m_curSession->layer()->isConnected() ) {
491 m_connect->setEnabled( false ); 497 m_connect->setEnabled( false );
492 m_disconnect->setEnabled( true ); 498 m_disconnect->setEnabled( true );
499 m_recordScript->setEnabled( true );
500 m_saveScript->setEnabled( true );
501 m_runScript->setEnabled( true );
493 } else { 502 } else {
494 m_connect->setEnabled( true ); 503 m_connect->setEnabled( true );
495 m_disconnect->setEnabled( false ); 504 m_disconnect->setEnabled( false );
505 m_recordScript->setEnabled( false );
506 m_saveScript->setEnabled( false );
507 m_runScript->setEnabled( false );
496 } 508 }
497 509
498 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 510 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
499 m_transfer->setEnabled( false ); 511 m_transfer->setEnabled( false );
500 } else { 512 } else {
501 m_transfer->setEnabled( true ); 513 m_transfer->setEnabled( true );
502 } 514 }
503 515
516
517
518
519
504 QWidget *w = m_curSession->widget(); 520 QWidget *w = m_curSession->widget();
505 if(w) w->setFocus(); 521 if(w) w->setFocus();
506 } 522 }
507} 523}
508 524
509void MainWindow::slotFullscreen() { 525void MainWindow::slotFullscreen() {
510 526
511 527
512 528
513 if ( m_isFullscreen ) { 529 if ( m_isFullscreen ) {
514 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); 530 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
515 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); 531 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
516 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 532 ( m_curSession->emulationHandler() )->cornerButton()->hide();
517 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 533 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
518 534
519 } else { 535 } else {
520 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 536 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
521 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 537 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
522 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 538 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
523 , QPoint(0,0), false ); 539 , QPoint(0,0), false );
524 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 540 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
525 ( m_curSession->widgetStack() )->setFocus(); 541 ( m_curSession->widgetStack() )->setFocus();
526 ( m_curSession->widgetStack() )->show(); 542 ( m_curSession->widgetStack() )->show();
527 543