Konsole::KeyboardTranslator

Search for usage in LXR

Konsole::KeyboardTranslator Class Reference

#include <KeyboardTranslator.h>

Classes

class  Entry
 

Public Types

enum  Command {
  NoCommand = 0 , SendCommand = 1 , ScrollPageUpCommand = 2 , ScrollPageDownCommand = 4 ,
  ScrollLineUpCommand = 8 , ScrollLineDownCommand = 16 , ScrollLockCommand = 32 , ScrollUpToTopCommand = 64 ,
  ScrollDownToBottomCommand = 128 , EraseCommand = 256
}
 
typedef QFlags< CommandCommands
 
enum  State {
  NoState = 0 , NewLineState = 1 , AnsiState = 2 , CursorKeysState = 4 ,
  AlternateScreenState = 8 , AnyModifierState = 16 , ApplicationKeypadState = 32
}
 
typedef QFlags< StateStates
 

Public Member Functions

 KeyboardTranslator (const QString &name)
 
void addEntry (const Entry &entry)
 
QString description () const
 
QList< Entryentries () const
 
Entry findEntry (int keyCode, Qt::KeyboardModifiers modifiers, States state=NoState) const
 
QString name () const
 
void removeEntry (const Entry &entry)
 
void replaceEntry (const Entry &existing, const Entry &replacement)
 
void setDescription (const QString &description)
 
void setName (const QString &name)
 

Static Public Attributes

static const Qt::KeyboardModifier CTRL_MOD = Qt::ControlModifier
 

Detailed Description

A convertor which maps between key sequences pressed by the user and the character strings which should be sent to the terminal and commands which should be invoked when those character sequences are pressed.

Konsole supports multiple keyboard translators, allowing the user to specify the character sequences which are sent to the terminal when particular key sequences are pressed.

A key sequence is defined as a key code, associated keyboard modifiers (Shift,Ctrl,Alt,Meta etc.) and state flags which indicate the state which the terminal must be in for the key sequence to apply.

Definition at line 52 of file KeyboardTranslator.h.

Member Typedef Documentation

◆ Commands

◆ States

Member Enumeration Documentation

◆ Command

This enum describes commands which are associated with particular key sequences.

Enumerator
NoCommand 

Indicates that no command is associated with this command sequence.

SendCommand 

TODO Document me.

ScrollPageUpCommand 

Scroll the terminal display up one page.

ScrollPageDownCommand 

Scroll the terminal display down one page.

ScrollLineUpCommand 

Scroll the terminal display up one line.

ScrollLineDownCommand 

Scroll the terminal display down one line.

ScrollLockCommand 

Toggles scroll lock mode.

ScrollUpToTopCommand 

Scroll the terminal display up to the start of history.

ScrollDownToBottomCommand 

Scroll the terminal display down to the end of history.

EraseCommand 

Echos the operating system specific erase character.

Definition at line 94 of file KeyboardTranslator.h.

◆ State

The meaning of a particular key sequence may depend upon the state which the terminal emulation is in.

Therefore findEntry() may return a different Entry depending upon the state flags supplied.

This enum describes the states which may be associated with with a particular entry in the keyboard translation entry.

Enumerator
NoState 

Indicates that no special state is active.

NewLineState 

TODO More documentation.

AnsiState 

Indicates that the terminal is in 'Ansi' mode.

TODO: More documentation

CursorKeysState 

TODO More documentation.

AlternateScreenState 

Indicates that the alternate screen ( typically used by interactive programs such as screen or vim ) is active.

AnyModifierState 

Indicates that any of the modifier keys is active.

ApplicationKeypadState 

Indicates that the numpad is in application mode.

Definition at line 63 of file KeyboardTranslator.h.

Constructor & Destructor Documentation

◆ KeyboardTranslator()

KeyboardTranslator::KeyboardTranslator ( const QString & name)

Constructs a new keyboard translator with the given name.

Definition at line 800 of file KeyboardTranslator.cpp.

Member Function Documentation

◆ addEntry()

void KeyboardTranslator::addEntry ( const Entry & entry)

Adds an entry to this keyboard translator's table.

Entries can be looked up according to their key sequence using findEntry()

Definition at line 827 of file KeyboardTranslator.cpp.

◆ description()

QString KeyboardTranslator::description ( ) const

Returns the descriptive name of this keyboard translator.

Definition at line 809 of file KeyboardTranslator.cpp.

◆ entries()

QList< KeyboardTranslator::Entry > KeyboardTranslator::entries ( ) const

Returns a list of all entries in the translator.

Definition at line 822 of file KeyboardTranslator.cpp.

◆ findEntry()

KeyboardTranslator::Entry KeyboardTranslator::findEntry ( int keyCode,
Qt::KeyboardModifiers modifiers,
States state = NoState ) const

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 a null Entry otherwise ( ie. entry.isNull() will return true )

Parameters
keyCodeA key code from the Qt::Key enum
modifiersA combination of modifiers
stateOptional flags which specify the current state of the terminal

Definition at line 842 of file KeyboardTranslator.cpp.

◆ name()

QString KeyboardTranslator::name ( ) const

Returns the name of this keyboard translator.

Definition at line 817 of file KeyboardTranslator.cpp.

◆ removeEntry()

void KeyboardTranslator::removeEntry ( const Entry & entry)

Removes an entry from the table.

Definition at line 838 of file KeyboardTranslator.cpp.

◆ replaceEntry()

void KeyboardTranslator::replaceEntry ( const Entry & existing,
const Entry & replacement )

Replaces an entry in the translator.

If the existing entry is null, then this is equivalent to calling addEntry(replacement)

Definition at line 832 of file KeyboardTranslator.cpp.

◆ setDescription()

void KeyboardTranslator::setDescription ( const QString & description)

Sets the descriptive name of this keyboard translator.

Definition at line 805 of file KeyboardTranslator.cpp.

◆ setName()

void KeyboardTranslator::setName ( const QString & name)

Sets the name of this keyboard translator.

Definition at line 813 of file KeyboardTranslator.cpp.

Member Data Documentation

◆ CTRL_MOD

const Qt::KeyboardModifier KeyboardTranslator::CTRL_MOD = Qt::ControlModifier
static

The modifier code for the actual Ctrl key on this OS.

Definition at line 306 of file KeyboardTranslator.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.