author | josef <josef> | 2002-11-01 11:12:54 (UTC) |
---|---|---|
committer | josef <josef> | 2002-11-01 11:12:54 (UTC) |
commit | 4c5a56dbaddb3ac6b587c61a8ba6841987cf60fa (patch) (side-by-side diff) | |
tree | 0172b37a635518ab48dcd0919d803371722a58c6 | |
parent | f99ad6016519a2f553c52812bac7859adb9aaa94 (diff) | |
download | opie-4c5a56dbaddb3ac6b587c61a8ba6841987cf60fa.zip opie-4c5a56dbaddb3ac6b587c61a8ba6841987cf60fa.tar.gz opie-4c5a56dbaddb3ac6b587c61a8ba6841987cf60fa.tar.bz2 |
- allow toggling of line wrap via menu, as requested
If there was an icon, an entry in the menu bar could be made.
-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; |