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
@@ -11,13 +11,13 @@
EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
: QObject(0, name )
{
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 );
connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ),
@@ -196,6 +196,11 @@ void EmulationHandler::runScript(const Script *script) {
void EmulationHandler::copy() {
m_teWid->emitSelection();
}
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
@@ -63,12 +63,14 @@ public:
/* Stop recording and remove the current script from memory */
void clearScript();
/* 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 );
public slots:
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
@@ -218,12 +218,19 @@ void MainWindow::initUI() {
m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
0, this, 0 );
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
*/
m_isFullscreen = false;
@@ -321,12 +328,13 @@ void MainWindow::initUI() {
m_transfer->setEnabled( false );
m_scripts->setItemEnabled(m_runScript_id, false);
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
*/
connect( m_sessionsPop, SIGNAL(activated( int ) ),
this, SLOT(slotProfile( int ) ) );
@@ -522,12 +530,13 @@ void MainWindow::slotClose() {
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
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();
}
@@ -562,12 +571,13 @@ void MainWindow::create( const Profile& prof ) {
// dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
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 );
m_scripts->setItemEnabled(m_runScript_id, false);
@@ -578,12 +588,18 @@ 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()
{
if ( currentSession() ) {
@@ -651,16 +667,43 @@ void MainWindow::slotSessionChanged( Session* ses ) {
m_transfer->setEnabled( true );
}
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() {
if ( m_isFullscreen ) {
( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
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
@@ -64,12 +64,13 @@ private slots:
void slotOpenKeb(bool);
void slotOpenButtons(bool);
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? */
void slotCopy();
void slotPaste();
@@ -116,17 +117,19 @@ private:
QAction* m_setProfiles;
QAction* m_openKeys;
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;
};
#endif