-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 5f6dc12..e3c3c38 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -429,49 +429,56 @@ void MainWindow::slotSaveScript() { | |||
429 | populateScripts(); | 429 | populateScripts(); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | } | 432 | } |
433 | 433 | ||
434 | void MainWindow::slotRunScript(int id) { | 434 | void MainWindow::slotRunScript(int id) { |
435 | if (currentSession()) { | 435 | if (currentSession()) { |
436 | int index = m_scriptsPop->indexOf(id); | 436 | int index = m_scriptsPop->indexOf(id); |
437 | DocLnk *lnk = m_scriptsData.at(index); | 437 | DocLnk *lnk = m_scriptsData.at(index); |
438 | QString filePath = lnk->file(); | 438 | QString filePath = lnk->file(); |
439 | Script script(filePath); | 439 | Script script(filePath); |
440 | currentSession()->emulationHandler()->runScript(&script); | 440 | currentSession()->emulationHandler()->runScript(&script); |
441 | } | 441 | } |
442 | } | 442 | } |
443 | 443 | ||
444 | void MainWindow::slotConnect() { | 444 | void MainWindow::slotConnect() { |
445 | if ( currentSession() ) { | 445 | if ( currentSession() ) { |
446 | bool ret = currentSession()->layer()->open(); | 446 | bool ret = currentSession()->layer()->open(); |
447 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 447 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
448 | QObject::tr("Failed"), | 448 | QObject::tr("Failed"), |
449 | QObject::tr("Connecting failed for this session.")); | 449 | QObject::tr("Connecting failed for this session.")); |
450 | else { | 450 | else { |
451 | m_connect->setEnabled( false ); | 451 | m_connect->setEnabled( false ); |
452 | m_disconnect->setEnabled( true ); | 452 | m_disconnect->setEnabled( true ); |
453 | m_transfer->setEnabled( true ); | 453 | |
454 | // if it does not support file transfer, disable the menu entry | ||
455 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | ||
456 | m_transfer->setEnabled( false ); | ||
457 | } else { | ||
458 | m_transfer->setEnabled( true ); | ||
459 | } | ||
460 | |||
454 | m_recordScript->setEnabled( true ); | 461 | m_recordScript->setEnabled( true ); |
455 | m_scripts->setItemEnabled(m_runScript_id, true); | 462 | m_scripts->setItemEnabled(m_runScript_id, true); |
456 | } | 463 | } |
457 | } | 464 | } |
458 | } | 465 | } |
459 | 466 | ||
460 | void MainWindow::slotDisconnect() { | 467 | void MainWindow::slotDisconnect() { |
461 | if ( currentSession() ) { | 468 | if ( currentSession() ) { |
462 | currentSession()->layer()->close(); | 469 | currentSession()->layer()->close(); |
463 | m_connect->setEnabled( true ); | 470 | m_connect->setEnabled( true ); |
464 | m_disconnect->setEnabled( false ); | 471 | m_disconnect->setEnabled( false ); |
465 | m_transfer->setEnabled( false ); | 472 | m_transfer->setEnabled( false ); |
466 | m_recordScript->setEnabled( false); | 473 | m_recordScript->setEnabled( false); |
467 | m_saveScript->setEnabled( false ); | 474 | m_saveScript->setEnabled( false ); |
468 | m_scripts->setItemEnabled(m_runScript_id, false); | 475 | m_scripts->setItemEnabled(m_runScript_id, false); |
469 | } | 476 | } |
470 | } | 477 | } |
471 | 478 | ||
472 | void MainWindow::slotTerminate() { | 479 | void MainWindow::slotTerminate() { |
473 | if ( currentSession() ) | 480 | if ( currentSession() ) |
474 | currentSession()->layer()->close(); | 481 | currentSession()->layer()->close(); |
475 | 482 | ||
476 | slotClose(); | 483 | slotClose(); |
477 | /* FIXME move to the next session */ | 484 | /* FIXME move to the next session */ |
@@ -550,49 +557,48 @@ void MainWindow::create( const Profile& prof ) { | |||
550 | 557 | ||
551 | m_sessions.append( ses ); | 558 | m_sessions.append( ses ); |
552 | tabWidget()->add( ses ); | 559 | tabWidget()->add( ses ); |
553 | tabWidget()->repaint(); | 560 | tabWidget()->repaint(); |
554 | m_curSession = ses; | 561 | m_curSession = ses; |
555 | 562 | ||
556 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 563 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
557 | m_connect->setEnabled( true ); | 564 | m_connect->setEnabled( true ); |
558 | m_disconnect->setEnabled( false ); | 565 | m_disconnect->setEnabled( false ); |
559 | m_terminate->setEnabled( true ); | 566 | m_terminate->setEnabled( true ); |
560 | m_fullscreen->setEnabled( true ); | 567 | m_fullscreen->setEnabled( true ); |
561 | m_closewindow->setEnabled( true ); | 568 | m_closewindow->setEnabled( true ); |
562 | m_transfer->setEnabled( false ); | 569 | m_transfer->setEnabled( false ); |
563 | m_recordScript->setEnabled( false ); | 570 | m_recordScript->setEnabled( false ); |
564 | m_saveScript->setEnabled( false ); | 571 | m_saveScript->setEnabled( false ); |
565 | m_scripts->setItemEnabled(m_runScript_id, false); | 572 | m_scripts->setItemEnabled(m_runScript_id, false); |
566 | 573 | ||
567 | // is io_layer wants direct connection, then autoconnect | 574 | // is io_layer wants direct connection, then autoconnect |
568 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 575 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
569 | if (prof.autoConnect()) { | 576 | if (prof.autoConnect()) { |
570 | slotConnect(); | 577 | slotConnect(); |
571 | } | 578 | } |
572 | 579 | ||
573 | 580 | ||
574 | |||
575 | QWidget *w = currentSession()->widget(); | 581 | QWidget *w = currentSession()->widget(); |
576 | if(w) w->setFocus(); | 582 | if(w) w->setFocus(); |
577 | 583 | ||
578 | m_kb->load(currentSession()->profile()); | 584 | m_kb->load(currentSession()->profile()); |
579 | } | 585 | } |
580 | 586 | ||
581 | void MainWindow::slotTransfer() | 587 | void MainWindow::slotTransfer() |
582 | { | 588 | { |
583 | if ( currentSession() ) { | 589 | if ( currentSession() ) { |
584 | Session *mysession = currentSession(); | 590 | Session *mysession = currentSession(); |
585 | TransferDialog dlg(mysession->widgetStack(), this); | 591 | TransferDialog dlg(mysession->widgetStack(), this); |
586 | mysession->setTransferDialog(&dlg); | 592 | mysession->setTransferDialog(&dlg); |
587 | dlg.show(); | 593 | dlg.show(); |
588 | //dlg.showMaximized(); | 594 | //dlg.showMaximized(); |
589 | //currentSession()->widgetStack()->add(dlg); | 595 | //currentSession()->widgetStack()->add(dlg); |
590 | //dlg.exec(); | 596 | //dlg.exec(); |
591 | while(dlg.isRunning()) qApp->processEvents(); | 597 | while(dlg.isRunning()) qApp->processEvents(); |
592 | mysession->setTransferDialog(0l); | 598 | mysession->setTransferDialog(0l); |
593 | } | 599 | } |
594 | } | 600 | } |
595 | 601 | ||
596 | 602 | ||
597 | void MainWindow::slotOpenKeb(bool state) { | 603 | void MainWindow::slotOpenKeb(bool state) { |
598 | 604 | ||