From 49c91a5365906868dbf236da79bc902bb754183a Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 2 Apr 2000 13:01:57 +0000 Subject: [PATCH] Yeah! It works ! konsole embeds properly in konqueror now ! ;-) Fixed the key events not going through by: - if ( parent ) parent->installEventFilter( this ); + qApp->installEventFilter( this ); Hmm, this approach sucks though - if embedding 2 konsoles one never gets the keypresses. And fixed crash on keypress by initialising the keytrans stuff in konsole_part.C - looks like this could be better designed with the singleton pattern... Reminder: click on kdebase/konsole/src/sample.shell to test this. Now, how to integrate this better... svn path=/trunk/kdebase/konsole/; revision=45387 --- include/TEWidget.h | 1 + src/TEWidget.C | 10 ++++++++-- src/konsole_part.C | 12 ++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/TEWidget.h b/include/TEWidget.h index 1b4dd715..1a4df136 100644 --- a/include/TEWidget.h +++ b/include/TEWidget.h @@ -31,6 +31,7 @@ class TEWidget : public QFrame public: TEWidget(QWidget *parent=0, const char *name=0); + virtual ~TEWidget(); public: diff --git a/src/TEWidget.C b/src/TEWidget.C index d6c1d6a7..211ddf6b 100644 --- a/src/TEWidget.C +++ b/src/TEWidget.C @@ -264,10 +264,15 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) setVTFont( QFont("fixed") ); setColorTable(base_color_table); // init color table - if ( parent ) parent->installEventFilter( this ); //FIXME: see below + qApp->installEventFilter( this ); //FIXME: see below } //FIXME: make proper destructor +// Here's a start (David) +TEWidget::~TEWidget() +{ + qApp->removeEventFilter( this ); +} /* ------------------------------------------------------------------------- */ /* */ @@ -866,7 +871,8 @@ bool TEWidget::eventFilter( QObject *, QEvent *e ) QApplication::sendEvent(scrollbar, e); } if ( e->type() == QEvent::KeyPress ) - { QKeyEvent* ke = (QKeyEvent*)e; + { + QKeyEvent* ke = (QKeyEvent*)e; actSel=0; // Key stroke implies a screen update, so TEWidget won't // know where the current selection is. diff --git a/src/konsole_part.C b/src/konsole_part.C index 55c7b734..da02cee7 100644 --- a/src/konsole_part.C +++ b/src/konsole_part.C @@ -98,7 +98,6 @@ konsolePart::konsolePart(QWidget *parent, const char *name) //bool welcome = true; bool histon = true; const char* wname = PACKAGE; - const char* shell = getenv("SHELL"); // QCString sz = ""; //sz = args->getOption("vt_sz"); @@ -108,10 +107,10 @@ konsolePart::konsolePart(QWidget *parent, const char *name) QStrList eargs; // welcome = args->isSet("welcome"); + const char* shell = getenv("SHELL"); if (shell == NULL || *shell == '\0') shell = "/bin/sh"; - // shell = "/bin/ls"; - shell = "/usr/bin/mc"; - eargs.append(shell); + //shell = "/usr/bin/mc"; + eargs.append(shell); te = new TEWidget(parent); te->setFocusPolicy(QWidget::ClickFocus); te->setMinimumSize(150,70); // allow resizing, cause resize in TEWidget @@ -128,6 +127,11 @@ konsolePart::konsolePart(QWidget *parent, const char *name) // kDebugInfo("Loading successful"); // kDebugInfo("XML file set"); + + // This is needed since only konsole.C does it + // Without those two -> crash on keypress... (David) + KeyTrans::loadAll(); + initial->getEmulation()->setKeytrans(0); }