-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 @@ -16,3 +16,3 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c // 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 ); @@ -201 +201,6 @@ void EmulationHandler::paste() { } + +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 @@ -68,2 +68,4 @@ public: + /* Propagate change to widget */ + void setWrap(int columns); signals: 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 @@ -223,2 +223,9 @@ void MainWindow::initUI() { + /* + * 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() ) ); @@ -326,2 +333,3 @@ void MainWindow::initUI() { m_closewindow->setEnabled( false ); + m_wrap->setEnabled( false ); @@ -527,2 +535,3 @@ void MainWindow::slotClose() { m_fullscreen->setEnabled( false ); + m_wrap->setEnabled( false ); m_closewindow->setEnabled( false ); @@ -567,2 +576,3 @@ void MainWindow::create( const Profile& prof ) { m_fullscreen->setEnabled( true ); + m_wrap->setEnabled( true ); m_closewindow->setEnabled( true ); @@ -583,2 +593,8 @@ void MainWindow::create( const Profile& prof ) { + if(currentSession()->profile().readNumEntry("Wrap", 80)){ + m_isWrapped = true; + } else { + m_isWrapped = false; + } + m_kb->load(currentSession()->profile()); @@ -656,2 +672,8 @@ void MainWindow::slotSessionChanged( Session* ses ) { + if(currentSession()->profile().readNumEntry("Wrap", 80)){ + m_isWrapped = true; + } else { + m_isWrapped = false; + } + m_kb->load(currentSession()->profile()); @@ -660,2 +682,23 @@ void MainWindow::slotSessionChanged( Session* ses ) { +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 @@ -69,2 +69,3 @@ private slots: void slotFullscreen(); + void slotWrap(); void slotSessionChanged( Session* ); @@ -121,2 +122,3 @@ private: QAction* m_fullscreen; + QAction* m_wrap; QAction* m_closewindow; @@ -126,2 +128,3 @@ private: bool m_isFullscreen; + bool m_isWrapped; |