-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 43 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 3 |
4 files changed, 54 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index e0f63cd..7924568 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -13,9 +13,9 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c | |||
13 | { | 13 | { |
14 | m_teWid = new TEWidget( parent, "TerminalMain"); | 14 | m_teWid = new TEWidget( parent, "TerminalMain"); |
15 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 15 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
16 | // use setWrapAt(80) for normal console with scrollbar | 16 | // use setWrapAt(80) for normal console with scrollbar |
17 | m_teWid->setWrapAt(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 17 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); |
18 | m_teWid->setMinimumSize(150, 70 ); | 18 | m_teWid->setMinimumSize(150, 70 ); |
19 | m_script = 0; | 19 | m_script = 0; |
20 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 20 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
21 | m_teEmu = new TEmuVt102(m_teWid ); | 21 | m_teEmu = new TEmuVt102(m_teWid ); |
@@ -198,4 +198,9 @@ void EmulationHandler::copy() { | |||
198 | } | 198 | } |
199 | void EmulationHandler::paste() { | 199 | void EmulationHandler::paste() { |
200 | m_teWid->pasteClipboard(); | 200 | m_teWid->pasteClipboard(); |
201 | } | 201 | } |
202 | |||
203 | void EmulationHandler::setWrap(int columns) { | ||
204 | m_teWid->setWrapAt(columns); | ||
205 | } | ||
206 | |||
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h index 12abbc5..7bc6f16 100644 --- a/noncore/apps/opie-console/emulation_handler.h +++ b/noncore/apps/opie-console/emulation_handler.h | |||
@@ -65,8 +65,10 @@ public: | |||
65 | 65 | ||
66 | /* Run a script by forwarding its keys to the EmulationLayer */ | 66 | /* Run a script by forwarding its keys to the EmulationLayer */ |
67 | void runScript(const Script *); | 67 | void runScript(const Script *); |
68 | 68 | ||
69 | /* Propagate change to widget */ | ||
70 | void setWrap(int columns); | ||
69 | signals: | 71 | signals: |
70 | void send( const QByteArray& ); | 72 | void send( const QByteArray& ); |
71 | void changeSize(int rows, int cols ); | 73 | void changeSize(int rows, int cols ); |
72 | 74 | ||
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 | |||
@@ -220,8 +220,15 @@ void MainWindow::initUI() { | |||
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 | */ |
@@ -323,8 +330,9 @@ void MainWindow::initUI() { | |||
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 | */ |
@@ -524,8 +532,9 @@ void MainWindow::slotClose() { | |||
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(); |
@@ -564,8 +573,9 @@ void MainWindow::create( const Profile& prof ) { | |||
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 ); |
@@ -580,8 +590,14 @@ void MainWindow::create( const Profile& prof ) { | |||
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() |
@@ -653,12 +669,39 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
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 | ||
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 3b16f0a..37219c5 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -66,8 +66,9 @@ private slots: | |||
66 | void slotRecordScript(); | 66 | void slotRecordScript(); |
67 | void slotSaveScript(); | 67 | void slotSaveScript(); |
68 | void slotRunScript(int); | 68 | void slotRunScript(int); |
69 | void slotFullscreen(); | 69 | void slotFullscreen(); |
70 | void slotWrap(); | ||
70 | void slotSessionChanged( Session* ); | 71 | void slotSessionChanged( Session* ); |
71 | void slotKeyReceived(FKey, ushort, ushort, bool); | 72 | void slotKeyReceived(FKey, ushort, ushort, bool); |
72 | 73 | ||
73 | /* what could these both slot do? */ | 74 | /* what could these both slot do? */ |
@@ -118,13 +119,15 @@ private: | |||
118 | QAction* m_openButtons; | 119 | QAction* m_openButtons; |
119 | QAction* m_recordScript; | 120 | QAction* m_recordScript; |
120 | QAction* m_saveScript; | 121 | QAction* m_saveScript; |
121 | QAction* m_fullscreen; | 122 | QAction* m_fullscreen; |
123 | QAction* m_wrap; | ||
122 | QAction* m_closewindow; | 124 | QAction* m_closewindow; |
123 | 125 | ||
124 | FunctionKeyboard *m_kb; | 126 | FunctionKeyboard *m_kb; |
125 | int m_runScript_id; | 127 | int m_runScript_id; |
126 | bool m_isFullscreen; | 128 | bool m_isFullscreen; |
129 | bool m_isWrapped; | ||
127 | 130 | ||
128 | QWidget* savedParentFullscreen; | 131 | QWidget* savedParentFullscreen; |
129 | }; | 132 | }; |
130 | 133 | ||