Commit 6a36400f authored by Robert Knight's avatar Robert Knight
Browse files

Reimplement Vt102Emulation::getErase() with new keyboard translator. Fixes...

Reimplement Vt102Emulation::getErase() with new keyboard translator.  Fixes backspace in Vim et. al.  Correct API documentation for KeyboardTranslator::findEntry().  Use an explicit KSharedConfigPtr to get the global config when writing default profile setting.  Appears to fix strange crash on exit.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=678227
parent 80ba5720
......@@ -17,6 +17,7 @@ The KDE 4.0 TODO List:
=== ESSENTIAL FEATURES ===
- Changing of a single tab's settings using konsoleprofile
- Input Method Event in terminal display widget
......@@ -24,11 +25,6 @@ The KDE 4.0 TODO List:
color in the color scheme. Make the setting of
boldness for characters more intuitive than in the KDE 3
series.
- Editing of key bindings
( this is the list which maps key sequences pressed by
the user to the corresponding text sequences
which are send to the terminal )
- Get the Konsole part working properly in other
major KDE programs, such as Dolphin,
......@@ -50,9 +46,6 @@ The KDE 4.0 TODO List:
the term "DCOP" for ideas on what users would like
to be able to do using Konsole's scripting facilities.
- Changing of profile using
a command-line tool
- Better documentation for shortcuts to move between views
(Shift+<Arrows> and Shift+Tab)
......@@ -66,6 +59,8 @@ The KDE 4.0 TODO List:
== BUGS ==
- Shortcuts do not word when the menu bar is hidden.
- Allow the user to over-ride the "no Ctrl+[Key] shortcuts" limitation with shortcuts
set in the configuration dialog, but warn the user if they try to do so. This is the
behaviour in KDE 3.
......@@ -75,6 +70,14 @@ image. A more efficient solution such as buffering successive image size change
be better. This would also help with applications such as Midnight Commander which
do not always behave well with lots of successive image size changes.
- KEYBOARD: Backspace key in Vim does not work.
- KEYBOARD: Pressing Alt+Number just prints the number instead of
something else.
== DOCUMENTATION ==
- Re-write the handbook contents to be up to date with the new user interface
== NON-ESSENTIAL TWEAKS ==
- Currently splitting the view creates a new terminal widget for each session
......@@ -172,6 +175,15 @@ do not always behave well with lots of successive image size changes.
=== DONE ===
- When loading a profile from disk, load the parent profile if necessary
and assign it to be the parent of the new profile.
- Editing of key bindings
( this is the list which maps key sequences pressed by
the user to the corresponding text sequences
which are send to the terminal )
- When splitting the view, avoid scrolling existing views.
- Changing of profile settings via a command-line tool
......
......@@ -246,8 +246,8 @@ public:
* Looks for an entry in this keyboard translator which matches the given
* key code, keyboard modifiers and state flags.
*
* Returns the matching entry if found or 0 if there is no matching entry
* in this keyboard translation.
* Returns the matching entry if found or a null Entry otherwise ( ie.
* entry.isNull() will return true )
*
* @param keyCode A key code from the Qt::Key enum
* @param modifiers A combination of modifiers
......
......@@ -484,13 +484,18 @@ QHash<Profile::Property,QVariant> ProfileCommandParser::parse(const QString& inp
{
QHash<Profile::Property,QVariant> changes;
// regular expression to parse profile change requests.
//
// format: property=value;property=value ...
//
// where 'property' is a word consisting only of characters from A-Z
// where 'value' is any sequence of characters other than a semi-colon
//
static QRegExp regExp("([a-zA-Z]+)=([^;]+)");
int offset = 0;
while ( regExp.indexIn(input,offset) != -1 )
{
//qDebug() << "Captured texts: " << regExp.capturedTexts();
if ( regExp.capturedTexts().count() == 3 )
{
Profile::Property property = Profile::lookupByName(
......
......@@ -197,8 +197,8 @@ SessionManager::~SessionManager()
while (infoIter.hasNext())
delete infoIter.next();
#warning "This prevents a crash to do with accessing a global static globalData() after destruction, but it is probably not the correct solution."
KGlobal::config()->sync();
//#warning "This prevents a crash to do with accessing a global static globalData() after destruction, but it is probably not the correct solution."
// KGlobal::config()->sync();
}
const QList<Session*> SessionManager::sessions()
......@@ -508,7 +508,8 @@ void SessionManager::setDefaultProfile(const QString& key)
qDebug() << "setting default session type to " << fileInfo.fileName();
KConfigGroup group = KGlobal::config()->group("Desktop Entry");
KSharedConfigPtr config = KGlobal::config();
KConfigGroup group = config->group("Desktop Entry");
group.writeEntry("DefaultProfile",fileInfo.fileName());
}
QSet<QString> SessionManager::findFavorites()
......
......@@ -2302,7 +2302,7 @@ void TerminalDisplay::keyPressEvent( QKeyEvent* event )
updateImage();
}
}
_actSel=0; // Key stroke implies a screen update, so TerminalDisplay won't
// know where the current selection is.
......@@ -2400,7 +2400,8 @@ bool TerminalDisplay::event( QEvent *e )
int keyCode = keyEvent->key() | keyEvent->modifiers();
if ( !standalone() &&
(keyEvent->modifiers() == Qt::ControlModifier) )
( (keyEvent->modifiers() == Qt::ControlModifier) ||
(keyEvent->modifiers() == Qt::AltModifier) ) )
{
keyEvent->accept();
return true;
......
......@@ -975,23 +975,35 @@ void Vt102Emulation::sendKeyEvent( QKeyEvent* event )
// lookup key binding
if ( _keyTranslator )
{
KeyboardTranslator::Entry entry = _keyTranslator->findEntry( event->key() ,
(Qt::KeyboardModifier)modifiers,
(KeyboardTranslator::State)states );
KeyboardTranslator::Entry entry = _keyTranslator->findEntry(
event->key() ,
(Qt::KeyboardModifier)modifiers,
(KeyboardTranslator::State)states );
// send result to terminal
QByteArray textToSend;
// if the Alt modifier is pressed and no entry has been found
// then the output is prefixed with an escape character
if ( modifiers & Qt::AltModifier && entry.isNull() )
{
qDebug() << "Alt modifier pressed, prepending Escape";
textToSend.prepend("\033");
//sendData("\033",1);
//return;
}
if ( entry.command() != KeyboardTranslator::NoCommand )
{
// TODO command handling
}
else if ( !entry.text().isEmpty() )
{
textToSend = _codec->fromUnicode(entry.text());
textToSend += _codec->fromUnicode(entry.text());
}
else
textToSend = _codec->fromUnicode(event->text());
textToSend += _codec->fromUnicode(event->text());
sendData( textToSend.constData() , textToSend.length() );
}
......@@ -1316,19 +1328,14 @@ bool Vt102Emulation::getMode(int m)
char Vt102Emulation::getErase() const
{
int cmd = KeyboardTranslator::NoCommand; //CMD_none;
QByteArray txt;
bool metaspecified;
#warning "Reimplement getErase() with new keyboard translator."
#if 0
if (_keyTranslator->findEntry(Qt::Key_Backspace, 0, &cmd, txt,
&metaspecified) && (cmd==CMD_send) && (txt.length() == 1))
return txt[0];
#endif
return '\b';
KeyboardTranslator::Entry entry = _keyTranslator->findEntry(
Qt::Key_Backspace,
(Qt::KeyboardModifier)0,
(KeyboardTranslator::State)0);
if ( entry.text().count() > 0 )
return entry.text()[0];
else
return '\b';
}
/* ------------------------------------------------------------------------- */
......
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