• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

Konsole::Session

Konsole::Session Class Reference

Represents a terminal session consisting of a pseudo-teletype and a terminal emulation. More...

#include <Session.h>

Inheritance diagram for Konsole::Session:

Inheritance graph
[legend]

List of all members.


Public Types

enum  TabTitleContext { LocalTabTitle, RemoteTabTitle }
enum  TitleRole { NameRole, DisplayedTitleRole }
enum  UserTitleChange {
  IconNameAndWindowTitle = 0, IconName = 1, WindowTitle = 2, TextColor = 10,
  BackgroundColor = 11, SessionName = 30, ProfileChange = 50
}

Public Slots

void close ()
void run ()
void setUserTitle (int what, const QString &caption)

Signals

void bellRequest (const QString &message)
void changeBackgroundColorRequest (const QColor &)
void changeForegroundColorRequest (const QColor &)
void changeTabTextColorRequest (int)
void finished ()
void flowControlEnabledChanged (bool enabled)
void openUrlRequest (const QString &url)
void profileChangeCommandReceived (const QString &text)
void receivedData (const QString &text)
void resizeRequest (const QSize &size)
void started ()
void stateChanged (int state)
void titleChanged ()
void zmodemDetected ()

Public Member Functions

void addView (TerminalDisplay *widget)
QStringList arguments () const
void cancelZModem ()
QString childName ()
void clearHistory ()
QString currentWorkingDirectory ()
Emulation * emulation () const
QStringList environment () const
bool flowControlEnabled () const
QString getDynamicTitle ()
KUrl getUrl ()
bool hasDarkBackground () const
const HistoryType & historyType () const
QString iconName () const
QString iconText () const
QString initialWorkingDirectory ()
bool isChildActive ()
bool isMonitorActivity () const
bool isMonitorSilence () const
bool isRunning () const
bool isZModemBusy ()
QString keyBindings () const
QString nameTitle () const
void openTeletype (int masterFd)
int processId () const
QString program () const
void refresh ()
void removeView (TerminalDisplay *widget)
void restoreSession (KConfigGroup &group)
void saveSession (KConfigGroup &group)
void sendText (const QString &text) const
 Session (QObject *parent=0)
int sessionId () const
void setAddToUtmp (bool)
void setArguments (const QStringList &arguments)
void setAutoClose (bool b)
void setCodec (QTextCodec *codec)
void setDarkBackground (bool darkBackground)
void setEnvironment (const QStringList &environment)
void setFlowControlEnabled (bool enabled)
void setHistoryType (const HistoryType &type)
void setIconName (const QString &iconName)
void setIconText (const QString &iconText)
void setInitialWorkingDirectory (const QString &dir)
void setKeyBindings (const QString &id)
void setMonitorActivity (bool)
void setMonitorSilence (bool)
void setMonitorSilenceSeconds (int seconds)
void setProgram (const QString &program)
void setSize (const QSize &size)
void setTabTitleFormat (TabTitleContext context, const QString &format)
void setTitle (TitleRole role, const QString &title)
QSize size ()
void startZModem (const QString &rz, const QString &dir, const QStringList &list)
QString tabTitleFormat (TabTitleContext context) const
QString title (TitleRole role) const
QString userTitle () const
QList< TerminalDisplay * > views () const
 ~Session ()

Properties

QString keyBindings
QString name
int processId
QSize size

Detailed Description

Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.

The pseudo-teletype (or PTY) handles I/O between the terminal process and Konsole. The terminal emulation ( Emulation and subclasses ) processes the output stream from the PTY and produces a character image which is then shown on views connected to the session.

Each Session can be connected to one or more views by using the addView() method. The attached views can then display output from the program running in the terminal or send input to the program in the terminal in the form of keypresses and mouse activity.

Definition at line 61 of file Session.h.


Member Enumeration Documentation

enum Konsole::Session::TabTitleContext

This enum describes the contexts for which separate tab title formats may be specified.

Enumerator:
LocalTabTitle  Default tab title format.
RemoteTabTitle  Tab title format used session currently contains a connection to a remote computer (via SSH).

Definition at line 159 of file Session.h.

enum Konsole::Session::TitleRole

This enum describes the available title roles.

Enumerator:
NameRole  The name of the session.

DisplayedTitleRole  The title of the session which is displayed in tabs etc.

Definition at line 270 of file Session.h.

enum Konsole::Session::UserTitleChange

Possible values of the what parameter for setUserTitle() See "Operating System Controls" section on http://rtfm.etla.org/xterm/ctlseq.html.

Enumerator:
IconNameAndWindowTitle 
IconName 
WindowTitle 
TextColor 
BackgroundColor 
SessionName 
ProfileChange 

Definition at line 381 of file Session.h.


Constructor & Destructor Documentation

Session::Session ( QObject *  parent = 0  )  [explicit]

Constructs a new session.

To start the terminal process, call the run() method, after specifying the program and arguments using setProgram() and setArguments()

If no program or arguments are specified explicitly, the Session falls back to using the program specified in the SHELL environment variable.

Definition at line 68 of file Session.cpp.

Session::~Session (  ) 

Definition at line 685 of file Session.cpp.


Member Function Documentation

void Session::addView ( TerminalDisplay *  widget  ) 

Adds a new view for this session.

The viewing widget will display the output from the terminal and input from the viewing widget (key presses, mouse activity etc.) will be sent to the terminal.

Views can be removed using removeView(). The session is automatically closed when the last view is removed.

Definition at line 226 of file Session.cpp.

QStringList Session::arguments (  )  const

Returns the arguments passed to the shell process when run() is called.

Definition at line 921 of file Session.cpp.

void Konsole::Session::bellRequest ( const QString &  message  )  [signal]

Emitted when a bell event occurs in the session.

void Session::cancelZModem (  ) 

Definition at line 998 of file Session.cpp.

void Konsole::Session::changeBackgroundColorRequest ( const QColor &   )  [signal]

Requests that the background color of views on this session should be changed.

void Konsole::Session::changeForegroundColorRequest ( const QColor &   )  [signal]

Requests that the text color of views on this session should be changed to color.

void Konsole::Session::changeTabTextColorRequest ( int   )  [signal]

Requests that the color the text for any tabs associated with this session should be changed;.

TODO: Document what the parameter does

QString Session::childName (  ) 

Returns the name of the current foreground process.

Definition at line 1128 of file Session.cpp.

void Session::clearHistory (  ) 

Clears the history store used by this session.

Definition at line 916 of file Session.cpp.

void Session::close (  )  [slot]

Closes the terminal session.

This sends a hangup signal (SIGHUP) to the terminal process and causes the finished() signal to be emitted. If the process does not respond to the SIGHUP signal then the terminal connection (the pty) is closed and Konsole waits for the process to exit.

Definition at line 654 of file Session.cpp.

QString Session::currentWorkingDirectory (  ) 

Returns the current directory of the foreground process in the session.

Definition at line 208 of file Session.cpp.

Emulation * Session::emulation (  )  const

Returns the terminal emulation instance being used to encode / decode characters to / from the process.

Definition at line 725 of file Session.cpp.

QStringList Session::environment (  )  const

Returns the environment of this session as a list of strings like VARIABLE=VALUE.

Definition at line 735 of file Session.cpp.

void Konsole::Session::finished (  )  [signal]

Emitted when the terminal process exits.

bool Session::flowControlEnabled (  )  const

Returns whether flow control is enabled for this terminal session.

Definition at line 982 of file Session.cpp.

void Konsole::Session::flowControlEnabledChanged ( bool  enabled  )  [signal]

Emitted when the flow control state changes.

Parameters:
enabled True if flow control is enabled or false otherwise.

QString Session::getDynamicTitle (  ) 

Returns a title generated from tab format and process information.

Definition at line 826 of file Session.cpp.

KUrl Session::getUrl (  ) 

Return URL for the session.

Definition at line 845 of file Session.cpp.

bool Session::hasDarkBackground (  )  const

Returns true if the session has a dark background.

See setDarkBackground()

Definition at line 181 of file Session.cpp.

const HistoryType & Session::historyType (  )  const

Returns the type of history store used by this session.

Definition at line 911 of file Session.cpp.

QString Session::iconName (  )  const

Returns the name of the icon associated with this session.

Definition at line 896 of file Session.cpp.

QString Session::iconText (  )  const

Returns the text of the icon associated with this session.

Definition at line 901 of file Session.cpp.

QString Konsole::Session::initialWorkingDirectory (  )  [inline]

Returns the session's current working directory.

Definition at line 197 of file Session.h.

bool Session::isChildActive (  ) 

Returns true if the user has started a program in the session.

Definition at line 1122 of file Session.cpp.

bool Session::isMonitorActivity (  )  const

Returns true if monitoring for activity is enabled.

Definition at line 932 of file Session.cpp.

bool Session::isMonitorSilence (  )  const

Returns true if monitoring for inactivity (silence) in the session is enabled.

Definition at line 934 of file Session.cpp.

bool Session::isRunning (  )  const

Returns true if the session is currently running.

This will be true after run() has been called successfully.

Definition at line 185 of file Session.cpp.

bool Konsole::Session::isZModemBusy (  )  [inline]

Definition at line 375 of file Session.h.

QString Konsole::Session::keyBindings (  )  const

Returns the name of the key bindings used by this session.

QString Konsole::Session::nameTitle (  )  const [inline]

Convenience method used to read the name property.

Returns title(Session::NameRole).

Definition at line 283 of file Session.h.

void Session::openTeletype ( int  masterFd  ) 

Connect to an existing terminal.

When a new Session() is constructed it automatically searches for and opens a new teletype. If you want to use an existing teletype (given its file descriptor) call this after constructing the session.

Calling openTeletype() while a session is running has no effect.

Parameters:
masterFd The file descriptor of the pseudo-teletype master (See KPtyProcess::KPtyProcess())

Definition at line 120 of file Session.cpp.

void Konsole::Session::openUrlRequest ( const QString &  url  )  [signal]

TODO: Document me.

int Konsole::Session::processId (  )  const

Returns the process id of the terminal process.

This is the id used by the system API to refer to the process.

void Konsole::Session::profileChangeCommandReceived ( const QString &  text  )  [signal]

Emitted when a profile change command is received from the terminal.

Parameters:
text The text of the command. This is a string of the form "PropertyName=Value;PropertyName=Value ..."

QString Session::program (  )  const

Returns the program name of the shell process started when run() is called.

Definition at line 926 of file Session.cpp.

void Konsole::Session::receivedData ( const QString &  text  )  [signal]

Emitted when output is received from the terminal process.

void Session::refresh (  ) 

Attempts to get the shell program to redraw the current display area.

This can be used after clearing the screen, for example, to get the shell to redraw the prompt line.

Definition at line 620 of file Session.cpp.

void Session::removeView ( TerminalDisplay *  widget  ) 

Removes a view from this session.

When the last view is removed, the session will be closed automatically.

widget will no longer display output from or send input to the terminal

Definition at line 269 of file Session.cpp.

void Konsole::Session::resizeRequest ( const QSize &  size  )  [signal]

Emitted when the terminal process requests a change in the size of the terminal window.

Parameters:
size The requested window size in terms of lines and columns.

void Session::restoreSession ( KConfigGroup &  group  ) 

Definition at line 1150 of file Session.cpp.

void Session::run (  )  [slot]

Starts the terminal session.

This creates the terminal process and connects the teletype to it.

Definition at line 339 of file Session.cpp.

void Session::saveSession ( KConfigGroup &  group  ) 

Definition at line 1143 of file Session.cpp.

void Session::sendText ( const QString &  text  )  const

Sends text to the current foreground terminal program.

Definition at line 680 of file Session.cpp.

int Session::sessionId (  )  const

Returns the unique ID for this session.

Definition at line 745 of file Session.cpp.

void Session::setAddToUtmp ( bool  set  ) 

Specifies whether a utmp entry should be created for the pty used by this session.

If true, KPty::login() is called when the session is started.

Definition at line 968 of file Session.cpp.

void Session::setArguments ( const QStringList &  arguments  ) 

Sets the command line arguments which the session's program will be passed when run() is called.

Definition at line 203 of file Session.cpp.

void Konsole::Session::setAutoClose ( bool  b  )  [inline]

Specifies whether to close the session automatically when the terminal process terminates.

Definition at line 310 of file Session.h.

void Session::setCodec ( QTextCodec *  codec  ) 

Sets the text codec used by this session's terminal emulation.

Definition at line 190 of file Session.cpp.

void Session::setDarkBackground ( bool  darkBackground  ) 

Sets whether the session has a dark background or not.

The session uses this information to set the COLORFGBG variable in the process's environment, which allows the programs running in the terminal to determine whether the background is light or dark and use appropriate colors by default.

This has no effect once the session is running.

Definition at line 177 of file Session.cpp.

void Session::setEnvironment ( const QStringList &  environment  ) 

Sets the environment for this session.

environment should be a list of strings like VARIABLE=VALUE

Definition at line 740 of file Session.cpp.

void Session::setFlowControlEnabled ( bool  enabled  ) 

Sets whether flow control is enabled for this terminal session.

Definition at line 973 of file Session.cpp.

void Session::setHistoryType ( const HistoryType &  type  ) 

Sets the type of history store used by this session.

Lines of output produced by the terminal are added to the history store. The type of history store used affects the number of lines which can be remembered before they are lost and the storage (in memory, on-disk etc.) used.

Definition at line 906 of file Session.cpp.

void Session::setIconName ( const QString &  iconName  ) 

Sets the name of the icon associated with this session.

Definition at line 882 of file Session.cpp.

void Session::setIconText ( const QString &  iconText  ) 

Sets the text of the icon associated with this session.

Definition at line 891 of file Session.cpp.

void Session::setInitialWorkingDirectory ( const QString &  dir  ) 

Sets the initial working directory for the session when it is run This has no effect once the session has been started.

Definition at line 199 of file Session.cpp.

void Session::setKeyBindings ( const QString &  id  ) 

Sets the key bindings used by this session.

The bindings specify how input key sequences are translated into the character stream which is sent to the terminal.

Parameters:
id The name of the key bindings to use. The names of available key bindings can be determined using the KeyboardTranslatorManager class.

Definition at line 750 of file Session.cpp.

void Session::setMonitorActivity ( bool  _monitor  ) 

Enables monitoring for activity in the session.

This will cause notifySessionState() to be emitted with the NOTIFYACTIVITY state flag when output is received from the terminal.

Definition at line 936 of file Session.cpp.

void Session::setMonitorSilence ( bool  _monitor  ) 

Enables monitoring for silence in the session.

This will cause notifySessionState() to be emitted with the NOTIFYSILENCE state flag when output is not received from the terminal for a certain period of time, specified with setMonitorSilenceSeconds()

Definition at line 944 of file Session.cpp.

void Session::setMonitorSilenceSeconds ( int  seconds  ) 

See setMonitorSilence().

Definition at line 960 of file Session.cpp.

void Session::setProgram ( const QString &  program  ) 

Sets the program to be executed when run() is called.

Definition at line 195 of file Session.cpp.

void Session::setSize ( const QSize &  size  ) 

Emits a request to resize the session to accommodate the specified window size.

Parameters:
size The size in lines and columns to request.

Definition at line 1110 of file Session.cpp.

void Session::setTabTitleFormat ( TabTitleContext  context,
const QString &  format 
)

Sets the format used by this session for tab titles.

Parameters:
context The context whoose format should be set.
format The tab title format. This may be a mixture of plain text and dynamic elements denoted by a '' character followed by a letter. (eg. d for directory). The dynamic elements available depend on the context

Definition at line 488 of file Session.cpp.

void Session::setTitle ( TitleRole  role,
const QString &  title 
)

Sets the session's title for the specified role to title.

Definition at line 755 of file Session.cpp.

void Session::setUserTitle ( int  what,
const QString &  caption 
) [slot]

Changes the session title or other customizable aspects of the terminal emulation display.

For a list of what may be changed see the Emulation::titleChanged() signal.

Parameters:
what The feature being changed. Value is one of UserTitleChange
caption The text part of the terminal command

Definition at line 415 of file Session.cpp.

QSize Konsole::Session::size (  ) 

Returns the terminal session's window size in lines and columns.

void Konsole::Session::started (  )  [signal]

Emitted when the terminal process starts.

void Session::startZModem ( const QString &  rz,
const QString &  dir,
const QStringList &  list 
)

Definition at line 1004 of file Session.cpp.

void Konsole::Session::stateChanged ( int  state  )  [signal]

Emitted when the activity state of this session changes.

Parameters:
state The new state of the session. This may be one of NOTIFYNORMAL, NOTIFYSILENCE or NOTIFYACTIVITY

QString Session::tabTitleFormat ( TabTitleContext  context  )  const

Returns the format used by this session for tab titles.

Definition at line 495 of file Session.cpp.

QString Session::title ( TitleRole  role  )  const

Returns the session's title for the specified role.

Definition at line 768 of file Session.cpp.

void Konsole::Session::titleChanged (  )  [signal]

Emitted when the session's title has changed.

QString Session::userTitle (  )  const

Return the session title set by the user (ie.

the program running in the terminal), or an empty string if the user has not set a custom title

Definition at line 484 of file Session.cpp.

QList< TerminalDisplay * > Session::views (  )  const

Returns the views connected to this session.

Definition at line 221 of file Session.cpp.

void Konsole::Session::zmodemDetected (  )  [signal]

TODO: Document me.


Property Documentation

QString Session::keyBindings [read, write]

Definition at line 68 of file Session.h.

QString Konsole::Session::name [read]

Definition at line 66 of file Session.h.

int Session::processId [read]

Definition at line 67 of file Session.h.

QSize Session::size [read, write]

Definition at line 69 of file Session.h.


The documentation for this class was generated from the following files:
  • Session.h
  • Session.cpp

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal