Commit a37ed321 authored by Robert Knight's avatar Robert Knight
Browse files

In the event that the keyboard translator is not available, print a warning to the terminal.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=677170
parent bb696c3c
......@@ -973,25 +973,40 @@ void Vt102Emulation::sendKeyEvent( QKeyEvent* event )
if ( getMode(MODE_AppScreen)) states |= KeyboardTranslator::AlternateScreenState;
// lookup key binding
if ( _keyTranslator )
{
KeyboardTranslator::Entry entry = _keyTranslator->findEntry( event->key() ,
(Qt::KeyboardModifier)modifiers,
(KeyboardTranslator::State)states );
// send result to terminal
QByteArray textToSend;
if ( entry.command() != KeyboardTranslator::NoCommand )
{
// TODO command handling
// send result to terminal
QByteArray textToSend;
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() );
}
else if ( !entry.text().isEmpty() )
else
{
textToSend = _codec->fromUnicode(entry.text());
// 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() );
}
else
textToSend = _codec->fromUnicode(event->text());
sendData( textToSend.constData() , textToSend.length() );
}
#if 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment