Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 936b1b2..d221715 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -216,16 +216,23 @@ void MainWindow::initUI() { | |||
216 | m_console->insertSeparator(); | 216 | m_console->insertSeparator(); |
217 | 217 | ||
218 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 218 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
219 | 0, this, 0 ); | 219 | 0, this, 0 ); |
220 | m_transfer->addTo( m_console ); | 220 | m_transfer->addTo( m_console ); |
221 | connect(m_transfer, SIGNAL(activated() ), | 221 | connect(m_transfer, SIGNAL(activated() ), |
222 | this, SLOT(slotTransfer() ) ); | 222 | this, SLOT(slotTransfer() ) ); |
223 | 223 | ||
224 | /* | ||
225 | * immediate change of line wrap policy | ||
226 | */ | ||
227 | m_isWrapped = false; | ||
228 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | ||
229 | m_wrap->addTo( m_console ); | ||
230 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | ||
224 | 231 | ||
225 | /* | 232 | /* |
226 | * fullscreen | 233 | * fullscreen |
227 | */ | 234 | */ |
228 | m_isFullscreen = false; | 235 | m_isFullscreen = false; |
229 | 236 | ||
230 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 237 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
231 | , QString::null, 0, this, 0); | 238 | , QString::null, 0, this, 0); |
@@ -319,16 +326,17 @@ void MainWindow::initUI() { | |||
319 | m_disconnect->setEnabled( false ); | 326 | m_disconnect->setEnabled( false ); |
320 | m_terminate->setEnabled( false ); | 327 | m_terminate->setEnabled( false ); |
321 | m_transfer->setEnabled( false ); | 328 | m_transfer->setEnabled( false ); |
322 | m_scripts->setItemEnabled(m_runScript_id, false); | 329 | m_scripts->setItemEnabled(m_runScript_id, false); |
323 | m_recordScript->setEnabled( false ); | 330 | m_recordScript->setEnabled( false ); |
324 | m_saveScript->setEnabled( false ); | 331 | m_saveScript->setEnabled( false ); |
325 | m_fullscreen->setEnabled( false ); | 332 | m_fullscreen->setEnabled( false ); |
326 | m_closewindow->setEnabled( false ); | 333 | m_closewindow->setEnabled( false ); |
334 | m_wrap->setEnabled( false ); | ||
327 | 335 | ||
328 | /* | 336 | /* |
329 | * connect to the menu activation | 337 | * connect to the menu activation |
330 | */ | 338 | */ |
331 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 339 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
332 | this, SLOT(slotProfile( int ) ) ); | 340 | this, SLOT(slotProfile( int ) ) ); |
333 | 341 | ||
334 | m_consoleWindow = new TabWidget( this, "blah"); | 342 | m_consoleWindow = new TabWidget( this, "blah"); |
@@ -520,16 +528,17 @@ void MainWindow::slotClose() { | |||
520 | m_connect->setEnabled( false ); | 528 | m_connect->setEnabled( false ); |
521 | m_disconnect->setEnabled( false ); | 529 | m_disconnect->setEnabled( false ); |
522 | m_terminate->setEnabled( false ); | 530 | m_terminate->setEnabled( false ); |
523 | m_transfer->setEnabled( false ); | 531 | m_transfer->setEnabled( false ); |
524 | m_recordScript->setEnabled( false ); | 532 | m_recordScript->setEnabled( false ); |
525 | m_saveScript->setEnabled( false ); | 533 | m_saveScript->setEnabled( false ); |
526 | m_scripts->setItemEnabled(m_runScript_id, false); | 534 | m_scripts->setItemEnabled(m_runScript_id, false); |
527 | m_fullscreen->setEnabled( false ); | 535 | m_fullscreen->setEnabled( false ); |
536 | m_wrap->setEnabled( false ); | ||
528 | m_closewindow->setEnabled( false ); | 537 | m_closewindow->setEnabled( false ); |
529 | } | 538 | } |
530 | 539 | ||
531 | m_kb->loadDefaults(); | 540 | m_kb->loadDefaults(); |
532 | } | 541 | } |
533 | 542 | ||
534 | /* | 543 | /* |
535 | * We will get the name | 544 | * We will get the name |
@@ -560,32 +569,39 @@ void MainWindow::create( const Profile& prof ) { | |||
560 | tabWidget()->repaint(); | 569 | tabWidget()->repaint(); |
561 | m_curSession = ses; | 570 | m_curSession = ses; |
562 | 571 | ||
563 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 572 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
564 | m_connect->setEnabled( true ); | 573 | m_connect->setEnabled( true ); |
565 | m_disconnect->setEnabled( false ); | 574 | m_disconnect->setEnabled( false ); |
566 | m_terminate->setEnabled( true ); | 575 | m_terminate->setEnabled( true ); |
567 | m_fullscreen->setEnabled( true ); | 576 | m_fullscreen->setEnabled( true ); |
577 | m_wrap->setEnabled( true ); | ||
568 | m_closewindow->setEnabled( true ); | 578 | m_closewindow->setEnabled( true ); |
569 | m_transfer->setEnabled( false ); | 579 | m_transfer->setEnabled( false ); |
570 | m_recordScript->setEnabled( false ); | 580 | m_recordScript->setEnabled( false ); |
571 | m_saveScript->setEnabled( false ); | 581 | m_saveScript->setEnabled( false ); |
572 | m_scripts->setItemEnabled(m_runScript_id, false); | 582 | m_scripts->setItemEnabled(m_runScript_id, false); |
573 | 583 | ||
574 | // is io_layer wants direct connection, then autoconnect | 584 | // is io_layer wants direct connection, then autoconnect |
575 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 585 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
576 | if (prof.autoConnect()) { | 586 | if (prof.autoConnect()) { |
577 | slotConnect(); | 587 | slotConnect(); |
578 | } | 588 | } |
579 | 589 | ||
580 | 590 | ||
581 | QWidget *w = currentSession()->widget(); | 591 | QWidget *w = currentSession()->widget(); |
582 | if(w) w->setFocus(); | 592 | if(w) w->setFocus(); |
583 | 593 | ||
594 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | ||
595 | m_isWrapped = true; | ||
596 | } else { | ||
597 | m_isWrapped = false; | ||
598 | } | ||
599 | |||
584 | m_kb->load(currentSession()->profile()); | 600 | m_kb->load(currentSession()->profile()); |
585 | } | 601 | } |
586 | 602 | ||
587 | void MainWindow::slotTransfer() | 603 | void MainWindow::slotTransfer() |
588 | { | 604 | { |
589 | if ( currentSession() ) { | 605 | if ( currentSession() ) { |
590 | Session *mysession = currentSession(); | 606 | Session *mysession = currentSession(); |
591 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 607 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
@@ -649,20 +665,47 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
649 | m_transfer->setEnabled( false ); | 665 | m_transfer->setEnabled( false ); |
650 | } else { | 666 | } else { |
651 | m_transfer->setEnabled( true ); | 667 | m_transfer->setEnabled( true ); |
652 | } | 668 | } |
653 | 669 | ||
654 | QWidget *w = m_curSession->widget(); | 670 | QWidget *w = m_curSession->widget(); |
655 | if(w) w->setFocus(); | 671 | if(w) w->setFocus(); |
656 | 672 | ||
673 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | ||
674 | m_isWrapped = true; | ||
675 | } else { | ||
676 | m_isWrapped = false; | ||
677 | } | ||
678 | |||
657 | m_kb->load(currentSession()->profile()); | 679 | m_kb->load(currentSession()->profile()); |
658 | } | 680 | } |
659 | } | 681 | } |
660 | 682 | ||
683 | void MainWindow::slotWrap() | ||
684 | { | ||
685 | if(m_curSession) | ||
686 | { | ||
687 | EmulationHandler *e = m_curSession->emulationHandler(); | ||
688 | if(e) | ||
689 | { | ||
690 | if(m_isWrapped) | ||
691 | { | ||
692 | e->setWrap(80); | ||
693 | m_isWrapped = false; | ||
694 | } | ||
695 | else | ||
696 | { | ||
697 | e->setWrap(0); | ||
698 | m_isWrapped = true; | ||
699 | } | ||
700 | } | ||
701 | } | ||
702 | } | ||
703 | |||
661 | void MainWindow::slotFullscreen() { | 704 | void MainWindow::slotFullscreen() { |
662 | 705 | ||
663 | 706 | ||
664 | 707 | ||
665 | if ( m_isFullscreen ) { | 708 | if ( m_isFullscreen ) { |
666 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 709 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
667 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 710 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
668 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 711 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |