Index: Vt102Emulation.cpp =================================================================== --- Vt102Emulation.cpp (revision 741260) +++ Vt102Emulation.cpp (working copy) @@ -976,51 +976,37 @@ if ( getMode(MODE_AppScreen)) states |= KeyboardTranslator::AlternateScreenState; // lookup key binding - if ( _keyTranslator ) - { + Q_ASSERT(_keyTranslator != 0); KeyboardTranslator::Entry entry = _keyTranslator->findEntry( event->key() , modifiers, states ); - // send result to terminal - QByteArray textToSend; + // send result to terminal + QByteArray textToSend; - // special handling for the Alt (aka. Meta) modifier. pressing - // Alt+[Character] results in Esc+[Character] being sent - // (unless there is an entry defined for this particular combination - // in the keyboard modifier) - if ( modifiers & Qt::AltModifier && entry.isNull() - && !event->text().isEmpty() ) - { - textToSend.prepend("\033"); - } + // special handling for the Alt (aka. Meta) modifier. pressing + // Alt+[Character] results in Esc+[Character] being sent + // (unless there is an entry defined for this particular combination + // in the keyboard modifier) + if ( modifiers & Qt::AltModifier && entry.isNull() + && !event->text().isEmpty() ) + { + textToSend.prepend("\033"); + } - if ( entry.command() != KeyboardTranslator::NoCommand ) - { - // TODO command handling - } - else if ( !entry.text().isEmpty() ) - { - textToSend += _codec->fromUnicode(entry.text()); - } - else - textToSend += _codec->fromUnicode(event->text()); - - sendData( textToSend.constData() , textToSend.length() ); + if ( entry.command() != KeyboardTranslator::NoCommand ) + { + // TODO command handling } - else + else if ( !entry.text().isEmpty() ) { - // print an error message to the terminal if no key translator has been - // set - QString translatorError = i18n("No keyboard translator available. " - "The information needed to convert key presses " - "into characters to send to the terminal " - "is missing."); - - reset(); - receiveData( translatorError.toAscii().constData() , translatorError.count() ); + textToSend += _codec->fromUnicode(entry.text()); } + else + textToSend += _codec->fromUnicode(event->text()); + + sendData( textToSend.constData() , textToSend.length() ); } #if 0 @@ -1330,6 +1316,7 @@ char Vt102Emulation::getErase() const { + Q_ASSERT(_keyTranslator != 0); KeyboardTranslator::Entry entry = _keyTranslator->findEntry( Qt::Key_Backspace, 0, Index: Emulation.cpp =================================================================== --- Emulation.cpp (revision 741260) +++ Emulation.cpp (working copy) @@ -25,7 +25,6 @@ #include "Emulation.h" // System -#include #include #include #include @@ -190,6 +189,7 @@ QString Emulation::keyBindings() { + Q_ASSERT(_keyTranslator != 0); return _keyTranslator->name(); }