summaryrefslogtreecommitdiff
authorjosef <josef>2002-11-01 11:12:54 (UTC)
committer josef <josef>2002-11-01 11:12:54 (UTC)
commit4c5a56dbaddb3ac6b587c61a8ba6841987cf60fa (patch) (side-by-side diff)
tree0172b37a635518ab48dcd0919d803371722a58c6
parentf99ad6016519a2f553c52812bac7859adb9aaa94 (diff)
downloadopie-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp7
-rw-r--r--noncore/apps/opie-console/emulation_handler.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp43
-rw-r--r--noncore/apps/opie-console/mainwindow.h3
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
@@ -15,5 +15,5 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
// 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;
@@ -200,2 +200,7 @@ 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
@@ -67,4 +67,6 @@ public:
void runScript(const Script *);
+ /* Propagate change to widget */
+ void setWrap(int columns);
signals:
void send( const QByteArray& );
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
@@ -222,4 +222,11 @@ void MainWindow::initUI() {
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() ) );
/*
@@ -325,4 +332,5 @@ void MainWindow::initUI() {
m_fullscreen->setEnabled( false );
m_closewindow->setEnabled( false );
+ m_wrap->setEnabled( false );
/*
@@ -526,4 +534,5 @@ void MainWindow::slotClose() {
m_scripts->setItemEnabled(m_runScript_id, false);
m_fullscreen->setEnabled( false );
+ m_wrap->setEnabled( false );
m_closewindow->setEnabled( false );
}
@@ -566,4 +575,5 @@ void MainWindow::create( const Profile& prof ) {
m_terminate->setEnabled( true );
m_fullscreen->setEnabled( true );
+ m_wrap->setEnabled( true );
m_closewindow->setEnabled( true );
m_transfer->setEnabled( false );
@@ -582,4 +592,10 @@ void MainWindow::create( const Profile& prof ) {
if(w) w->setFocus();
+ if(currentSession()->profile().readNumEntry("Wrap", 80)){
+ m_isWrapped = true;
+ } else {
+ m_isWrapped = false;
+ }
+
m_kb->load(currentSession()->profile());
}
@@ -655,8 +671,35 @@ void MainWindow::slotSessionChanged( Session* ses ) {
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
@@ -68,4 +68,5 @@ private slots:
void slotRunScript(int);
void slotFullscreen();
+ void slotWrap();
void slotSessionChanged( Session* );
void slotKeyReceived(FKey, ushort, ushort, bool);
@@ -120,4 +121,5 @@ private:
QAction* m_saveScript;
QAction* m_fullscreen;
+ QAction* m_wrap;
QAction* m_closewindow;
@@ -125,4 +127,5 @@ private:
int m_runScript_id;
bool m_isFullscreen;
+ bool m_isWrapped;
QWidget* savedParentFullscreen;