summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -13,9 +13,9 @@ 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 ) );
m_teEmu = new TEmuVt102(m_teWid );
@@ -198,4 +198,9 @@ 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
@@ -65,8 +65,10 @@ 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
@@ -220,8 +220,15 @@ void MainWindow::initUI() {
m_transfer->addTo( m_console );
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
*/
@@ -323,8 +330,9 @@ void MainWindow::initUI() {
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_fullscreen->setEnabled( false );
m_closewindow->setEnabled( false );
+ m_wrap->setEnabled( false );
/*
* connect to the menu activation
*/
@@ -524,8 +532,9 @@ void MainWindow::slotClose() {
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_scripts->setItemEnabled(m_runScript_id, false);
m_fullscreen->setEnabled( false );
+ m_wrap->setEnabled( false );
m_closewindow->setEnabled( false );
}
m_kb->loadDefaults();
@@ -564,8 +573,9 @@ void MainWindow::create( const Profile& prof ) {
m_connect->setEnabled( true );
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 );
m_saveScript->setEnabled( false );
@@ -580,8 +590,14 @@ 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());
}
void MainWindow::slotTransfer()
@@ -653,12 +669,39 @@ 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
@@ -66,8 +66,9 @@ private slots:
void slotRecordScript();
void slotSaveScript();
void slotRunScript(int);
void slotFullscreen();
+ void slotWrap();
void slotSessionChanged( Session* );
void slotKeyReceived(FKey, ushort, ushort, bool);
/* what could these both slot do? */
@@ -118,13 +119,15 @@ private:
QAction* m_openButtons;
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;
};