• Skip to content
  • Skip to link menu
KDE 4.1 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 59 of file SessionManager.h.


Signals

void favoriteStatusChanged (Profile::Ptr profile, bool favorite)
void profileAdded (Profile::Ptr ptr)
void profileChanged (Profile::Ptr ptr)
void profileRemoved (Profile::Ptr ptr)
void sessionUpdated (Session *session)
void shortcutChanged (Profile::Ptr profile, const QKeySequence &newShortcut)

Public Member Functions

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

Static Public Member Functions

static SessionManager * instance ()
static void setInstance (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 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 (  ) 

Kill all running sessions.

Definition at line 221 of file SessionManager.cpp.

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 (  ) 

Returns the set of the user's favorite profiles.

Definition at line 530 of file SessionManager.cpp.

SessionManager * SessionManager::instance (  )  [static]

Returns the session manager instance.

Definition at line 734 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 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::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

Returns the profile associated with a session.

Definition at line 376 of file SessionManager.cpp.

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

Returns a list of active sessions.

Definition at line 242 of file SessionManager.cpp.

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 
)

Sets the profile associated with a session.

Definition at line 380 of file SessionManager.cpp.

void SessionManager::setShortcut ( Profile::Ptr  profile,
const QKeySequence &  shortcut 
)

Associates a shortcut with a particular profile.

Definition at line 591 of file SessionManager.cpp.

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:
  • 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