Konsole
Konsole::SessionManager Class Reference
Manages running terminal sessions and the profiles which specify various settings for terminal sessions and their displays. More...
#include <SessionManager.h>

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 59 of file SessionManager.h.
Constructor & Destructor Documentation
SessionManager::SessionManager | ( | ) |
Constructs a new session manager and loads information about the available profiles.
Definition at line 71 of file SessionManager.cpp.
SessionManager::~SessionManager | ( | ) | [virtual] |
Destroys the SessionManager.
All running sessions should be closed (via closeAll()) and the SessionManager's state should be saved via saveState() before the SessionManager is destroyed.
Definition at line 230 of file SessionManager.cpp.
Member Function Documentation
void SessionManager::addProfile | ( | Profile::Ptr | type | ) |
Registers a new type of session.
The favorite status of the session ( as returned by isFavorite() ) is set to false by default.
Definition at line 464 of file SessionManager.cpp.
QStringList SessionManager::availableProfilePaths | ( | ) | const |
Searches for available profiles on-disk and returns a list of paths of profiles which can be loaded.
Definition at line 185 of file SessionManager.cpp.
void SessionManager::changeProfile | ( | Profile::Ptr | profile, | |
QHash< Profile::Property, QVariant > | propertyMap, | |||
bool | persistant = true | |||
) |
Updates a profile
with the changes specified in propertyMap
.
All sessions currently using the profile will be updated to reflect the new settings.
After the profile is updated, the profileChanged() signal will be emitted.
- Parameters:
-
profile The profile to change 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 326 of file SessionManager.cpp.
void SessionManager::closeAll | ( | ) |
Session * SessionManager::createSession | ( | Profile::Ptr | profile = Profile::Ptr() |
) |
Creates a new session using the settings specified by the specified profile.
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:
-
profile A profile containing the settings for the new session. If profile
is null the default profile (see defaultProfile()) will be used.
Definition at line 260 of file SessionManager.cpp.
Profile::Ptr 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 306 of file SessionManager.cpp.
bool SessionManager::deleteProfile | ( | Profile::Ptr | profile | ) |
Deletes the configuration file used to store a profile.
The profile will continue to exist while sessions are still using it. The profile will be marked as hidden (see Profile::setHidden() ) so that it does not show up in profile lists and future changes to the profile are not stored to disk.
Returns true if the profile was successfully deleted or false otherwise.
Definition at line 474 of file SessionManager.cpp.
Profile::Ptr SessionManager::fallbackProfile | ( | ) | const |
Returns a Profile object with hard-coded settings which is always available.
This can be used as a parent for new profiles which provides suitable default settings for all properties.
Definition at line 310 of file SessionManager.cpp.
void Konsole::SessionManager::favoriteStatusChanged | ( | Profile::Ptr | profile, | |
bool | favorite | |||
) | [signal] |
Emitted when the favorite status of a profile changes.
- Parameters:
-
profile The profile to change favorite Specifies whether the session is a favorite or not
Profile::Ptr SessionManager::findByShortcut | ( | const QKeySequence & | shortcut | ) |
Finds and loads the profile associated with the specified shortcut
key sequence and returns a pointer to it.
Definition at line 675 of file SessionManager.cpp.
QSet< Profile::Ptr > SessionManager::findFavorites | ( | ) |
int SessionManager::getRestoreId | ( | Session * | session | ) |
Definition at line 756 of file SessionManager.cpp.
Session * SessionManager::idToSession | ( | int | id | ) |
Definition at line 784 of file SessionManager.cpp.
SessionManager * SessionManager::instance | ( | ) | [static] |
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 197 of file SessionManager.cpp.
QList< Profile::Ptr > SessionManager::loadedProfiles | ( | ) | const |
Returns a list of 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 301 of file SessionManager.cpp.
Profile::Ptr 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:
- Pointer to a profile which can be passed to createSession() to create a new session using this profile.
Definition at line 105 of file SessionManager.cpp.
void Konsole::SessionManager::profileAdded | ( | Profile::Ptr | ptr | ) | [signal] |
Emitted when a profile is added to the manager.
void Konsole::SessionManager::profileChanged | ( | Profile::Ptr | ptr | ) | [signal] |
Emitted when a profile's properties are modified.
void Konsole::SessionManager::profileRemoved | ( | Profile::Ptr | ptr | ) | [signal] |
Emitted when a profile is removed from the manager.
void SessionManager::restoreSessions | ( | KConfig * | config | ) |
Definition at line 761 of file SessionManager.cpp.
void SessionManager::saveSessions | ( | KConfig * | config | ) |
Definition at line 733 of file SessionManager.cpp.
void SessionManager::saveState | ( | ) |
Saves state information (favorites, shortcuts, default profile etc.
) to disk.
Definition at line 210 of file SessionManager.cpp.
Profile::Ptr SessionManager::sessionProfile | ( | Session * | session | ) | const |
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 291 of file SessionManager.cpp.
void Konsole::SessionManager::sessionUpdated | ( | Session * | session | ) | [signal] |
Emitted when a session's settings are updated to match its current profile.
void SessionManager::setDefaultProfile | ( | Profile::Ptr | profile | ) |
Sets the profile
as the default profile for new sessions created with createSession().
Definition at line 513 of file SessionManager.cpp.
void SessionManager::setFavorite | ( | Profile::Ptr | profile, | |
bool | favorite | |||
) |
Specifies whether a profile should be included in the user's list of favorite sessions.
Definition at line 537 of file SessionManager.cpp.
static void Konsole::SessionManager::setInstance | ( | SessionManager * | instance | ) | [static] |
Sets the global session manager instance.
void SessionManager::setSessionProfile | ( | Session * | session, | |
Profile::Ptr | profile | |||
) |
void SessionManager::setShortcut | ( | Profile::Ptr | profile, | |
const QKeySequence & | shortcut | |||
) |
QKeySequence SessionManager::shortcut | ( | Profile::Ptr | profile | ) | const |
Returns the shortcut associated with a particular profile.
Definition at line 719 of file SessionManager.cpp.
void Konsole::SessionManager::shortcutChanged | ( | Profile::Ptr | profile, | |
const QKeySequence & | newShortcut | |||
) | [signal] |
Emitted when the shortcut for a profile is changed.
- Parameters:
-
profile The profile whoose status was changed newShortcut The new shortcut key sequence for the profile
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.
Definition at line 670 of file SessionManager.cpp.
void SessionManager::updateSession | ( | Session * | session | ) |
Updates a session's properties to match its current profile.
Definition at line 247 of file SessionManager.cpp.
The documentation for this class was generated from the following files: