-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 @@ -14,7 +14,7 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c m_teWid = new TEWidget( parent, "TerminalMain"); // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) // use setWrapAt(80) for normal console with scrollbar - m_teWid->setWrapAt(prof.readNumEntry("Wrap", 0) ? 0 : 80); + setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); m_teWid->setMinimumSize(150, 70 ); m_script = 0; parent->resize( m_teWid->calcSize(80, 24 ) ); @@ -199,3 +199,8 @@ void EmulationHandler::copy() { void EmulationHandler::paste() { m_teWid->pasteClipboard(); } + +void EmulationHandler::setWrap(int columns) { + m_teWid->setWrapAt(columns); +} + 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 @@ -66,6 +66,8 @@ public: /* Run a script by forwarding its keys to the EmulationLayer */ void runScript(const Script *); + /* Propagate change to widget */ + void setWrap(int columns); signals: void send( const QByteArray& ); void changeSize(int rows, int cols ); 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 @@ -221,6 +221,13 @@ void MainWindow::initUI() { connect(m_transfer, SIGNAL(activated() ), this, SLOT(slotTransfer() ) ); + /* + * immediate change of line wrap policy + */ + m_isWrapped = false; + m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); + m_wrap->addTo( m_console ); + connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); /* * fullscreen @@ -324,6 +331,7 @@ void MainWindow::initUI() { m_saveScript->setEnabled( false ); m_fullscreen->setEnabled( false ); m_closewindow->setEnabled( false ); + m_wrap->setEnabled( false ); /* * connect to the menu activation @@ -525,6 +533,7 @@ void MainWindow::slotClose() { m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); m_fullscreen->setEnabled( false ); + m_wrap->setEnabled( false ); m_closewindow->setEnabled( false ); } @@ -565,6 +574,7 @@ void MainWindow::create( const Profile& prof ) { m_disconnect->setEnabled( false ); m_terminate->setEnabled( true ); m_fullscreen->setEnabled( true ); + m_wrap->setEnabled( true ); m_closewindow->setEnabled( true ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false ); @@ -581,6 +591,12 @@ void MainWindow::create( const Profile& prof ) { QWidget *w = currentSession()->widget(); if(w) w->setFocus(); + if(currentSession()->profile().readNumEntry("Wrap", 80)){ + m_isWrapped = true; + } else { + m_isWrapped = false; + } + m_kb->load(currentSession()->profile()); } @@ -654,10 +670,37 @@ void MainWindow::slotSessionChanged( Session* ses ) { QWidget *w = m_curSession->widget(); if(w) w->setFocus(); + if(currentSession()->profile().readNumEntry("Wrap", 80)){ + m_isWrapped = true; + } else { + m_isWrapped = false; + } + m_kb->load(currentSession()->profile()); } } +void MainWindow::slotWrap() +{ + if(m_curSession) + { + EmulationHandler *e = m_curSession->emulationHandler(); + if(e) + { + if(m_isWrapped) + { + e->setWrap(80); + m_isWrapped = false; + } + else + { + e->setWrap(0); + m_isWrapped = true; + } + } + } +} + void MainWindow::slotFullscreen() { 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 @@ -67,6 +67,7 @@ private slots: void slotSaveScript(); void slotRunScript(int); void slotFullscreen(); + void slotWrap(); void slotSessionChanged( Session* ); void slotKeyReceived(FKey, ushort, ushort, bool); @@ -119,11 +120,13 @@ private: QAction* m_recordScript; QAction* m_saveScript; QAction* m_fullscreen; + QAction* m_wrap; QAction* m_closewindow; FunctionKeyboard *m_kb; int m_runScript_id; bool m_isFullscreen; + bool m_isWrapped; QWidget* savedParentFullscreen; }; |