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

Konsole

Konsole::SessionManager

Konsole::SessionManager Class Reference

#include <SessionManager.h>

Inheritance diagram for Konsole::SessionManager:

Inheritance graph
[legend]

List of all members.


Detailed Description

Manages running terminal sessions and the profiles which specify various settings for terminal sessions and their displays.

Profiles in the manager have a concept of favorite status, which can be used by widgets and dialogs in the application decide which sessions to list and how to display them. The favorite status of a profile can be altered using setFavorite() and retrieved using isFavorite()

Definition at line 57 of file SessionManager.h.


Signals

void profileAdded (const QString &key)
void profileRemoved (const QString &key)
void profileChanged (const QString &key)
void sessionUpdated (Session *session)
void favoriteStatusChanged (const QString &key, bool favorite)
void shortcutChanged (const QString &key, const QKeySequence &newShortcut)

Public Member Functions

 SessionManager ()
virtual ~SessionManager ()
QList< QString > loadedProfiles () const
QList< QString > availableProfilePaths () const
Profile * profile (const QString &key) const
QString addProfile (Profile *type)
QString loadProfile (const QString &path)
void changeProfile (const QString &key, QHash< Profile::Property, QVariant > propertyMap, bool persistant=true)
Profile * defaultProfile () const
QString defaultProfileKey () const
Session * createSession (const QString &key=QString())
void updateSession (Session *session)
const QList< Session * > sessions ()
bool deleteProfile (const QString &key)
void setDefaultProfile (const QString &key)
QSet< QString > findFavorites ()
QList< QKeySequence > shortcuts ()
QString findByShortcut (const QKeySequence &shortcut)
void setShortcut (const QString &key, const QKeySequence &shortcut)
QKeySequence shortcut (const QString &profileKey) const
void setFavorite (const QString &key, bool favorite)
void loadAllProfiles ()

Static Public Member Functions

static void setInstance (SessionManager *instance)
static SessionManager * instance ()

Protected Slots

void sessionTerminated (QObject *session)

Constructor & Destructor Documentation

SessionManager::SessionManager (  ) 

Constructs a new session manager and loads information about the available profiles.

Definition at line 70 of file SessionManager.cpp.

SessionManager::~SessionManager (  )  [virtual]

Definition at line 187 of file SessionManager.cpp.


Member Function Documentation

QList< QString > SessionManager::loadedProfiles (  )  const

Returns a list of keys for profiles which have been loaded.

Initially only the profile currently set as the default is loaded.

Favorite profiles are loaded automatically when findFavorites() is called.

All other profiles can be loaded by calling loadAllProfiles(). This may involves opening, reading and parsing all profiles from disk, and should only be done when necessary.

Definition at line 277 of file SessionManager.cpp.

QList< QString > SessionManager::availableProfilePaths (  )  const

Searches for available profiles on-disk and returns a list of paths of profiles which can be loaded.

Definition at line 160 of file SessionManager.cpp.

Profile * SessionManager::profile ( const QString &  key  )  const

Returns the session information object for the profile with the specified key or 0 if no profile with the specified key exists.

If key is empty, a pointer to the default profile is returned.

Definition at line 282 of file SessionManager.cpp.

QString SessionManager::addProfile ( Profile *  type  ) 

Registers a new type of session and returns the key which can be passed to createSession() to create new instances of the session.

The favorite status of the session ( as returned by isFavorite() ) is set to false by default.

Definition at line 437 of file SessionManager.cpp.

QString SessionManager::loadProfile ( const QString &  path  ) 

Loads a profile from the specified path and registers it with the SessionManager.

path may be relative or absolute. The path may just be the base name of the profile to load (eg. if the profile's full path is "<konsole data dir>/My Profile.profile" then both "konsole/My Profile.profile" , "My Profile.profile" and "My Profile" will be accepted)

Returns:
The profile key which can be used to create new sessions from this profile using createSession()

Definition at line 102 of file SessionManager.cpp.

void SessionManager::changeProfile ( const QString &  key,
QHash< Profile::Property, QVariant >  propertyMap,
bool  persistant = true 
)

Updates the profile associated with the specified key with the changes specified in propertyMap.

All sessions using the profile will be updated to reflect the new settings.

After the profile is updated, the profileChanged() signal will be emitted.

Parameters:
key The profile's key
propertyMap A map between profile properties and values describing the changes
persistant If true, the changes are saved to the profile's configuration file, set this to false if you want to preview possible changes to a profile but do not wish to make them permanent.

Definition at line 316 of file SessionManager.cpp.

Profile * SessionManager::defaultProfile (  )  const

Returns a Profile object describing the default type of session, which is used if createSession() is called with an empty configPath argument.

Definition at line 293 of file SessionManager.cpp.

QString SessionManager::defaultProfileKey (  )  const

Returns the key for the default profile.

Definition at line 298 of file SessionManager.cpp.

Session * SessionManager::createSession ( const QString &  key = QString()  ) 

Creates a new session using the settings specified by the specified profile key.

The new session has no views associated with it. A new TerminalDisplay view must be created in order to display the output from the terminal session and send keyboard or mouse input to it.

Parameters:
type Specifies the type of session to create. Passing an empty string will create a session using the default configuration.

Definition at line 230 of file SessionManager.cpp.

void SessionManager::updateSession ( Session *  session  ) 

Updates a session's properties to match its current profile.

Definition at line 217 of file SessionManager.cpp.

const QList< Session * > SessionManager::sessions (  ) 

Returns a list of active sessions.

Definition at line 212 of file SessionManager.cpp.

bool SessionManager::deleteProfile ( const QString &  key  ) 

Deletes the profile with the specified key.

The configuration file associated with the profile is deleted if possible.

Returns true if the profile was successfully deleted or false otherwise.

Definition at line 463 of file SessionManager.cpp.

void SessionManager::setDefaultProfile ( const QString &  key  ) 

Sets the profile with the specified key as the default type.

Definition at line 499 of file SessionManager.cpp.

QSet< QString > SessionManager::findFavorites (  ) 

Returns the set of keys for the user's favorite profiles.

Definition at line 520 of file SessionManager.cpp.

QList< QKeySequence > SessionManager::shortcuts (  ) 

Returns the list of shortcut key sequences which can be used to create new sessions based on existing profiles.

When one of the shortcuts is activated, use findByShortcut() to load the profile associated with the shortcut and obtain its key.

Definition at line 658 of file SessionManager.cpp.

QString SessionManager::findByShortcut ( const QKeySequence &  shortcut  ) 

Finds and loads the profile associated with the specified shortcut key sequence and returns its string key.

Definition at line 663 of file SessionManager.cpp.

void SessionManager::setShortcut ( const QString &  key,
const QKeySequence &  shortcut 
)

Associates a shortcut with a particular profile.

Definition at line 584 of file SessionManager.cpp.

QKeySequence SessionManager::shortcut ( const QString &  profileKey  )  const

Returns the shortcut associated with a particular profile.

Definition at line 708 of file SessionManager.cpp.

void SessionManager::setFavorite ( const QString &  key,
bool  favorite 
)

Specifies whether a profile should be included in the user's list of favorite sessions.

Definition at line 527 of file SessionManager.cpp.

void SessionManager::loadAllProfiles (  ) 

Loads all available profiles.

This involves reading each profile configuration file from disk and parsing it. Therefore it should only be done when necessary.

Definition at line 167 of file SessionManager.cpp.

static void Konsole::SessionManager::setInstance ( SessionManager *  instance  )  [static]

Sets the global session manager instance.

SessionManager * SessionManager::instance (  )  [static]

Returns the session manager instance.

Definition at line 726 of file SessionManager.cpp.

void Konsole::SessionManager::profileAdded ( const QString &  key  )  [signal]

Emitted when a profile is added to the manager.

void Konsole::SessionManager::profileRemoved ( const QString &  key  )  [signal]

Emitted when a profile is removed from the manager.

void Konsole::SessionManager::profileChanged ( const QString &  key  )  [signal]

Emitted when a profile's properties are modified.

void Konsole::SessionManager::sessionUpdated ( Session *  session  )  [signal]

Emitted when a session's settings are updated to match its current profile.

void Konsole::SessionManager::favoriteStatusChanged ( const QString &  key,
bool  favorite 
) [signal]

Emitted when the favorite status of a profile changes.

Parameters:
key The key for the profile
favorite Specifies whether the session is a favorite or not

void Konsole::SessionManager::shortcutChanged ( const QString &  key,
const QKeySequence &  newShortcut 
) [signal]

Emitted when the shortcut for a profile is changed.

Parameters:
key The key for the profile
newShortcut The new shortcut key sequence for the profile

void SessionManager::sessionTerminated ( QObject *  session  )  [protected, slot]

Called to inform the manager that a session has finished executing.

Parameters:
session The Session which has finished executing.

Definition at line 265 of file SessionManager.cpp.


The documentation for this class was generated from the following files:
  • SessionManager.h
  • SessionManager.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.4
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