• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
KateSessionManager Class Reference

#include <katesession.h>

Inherits TQObject.

Public Types

enum  { INVALID_SESSION = -1 }
 
enum  { STARTUP_NEW = 0 , STARTUP_LAST , STARTUP_MANUAL }
 
enum  { SWITCH_DISCARD = 0 , SWITCH_SAVE , SWITCH_ASK }
 

Signals

void switchOptionChanged ()
 
void sessionActivated (int newSessionId, int oldSessionId)
 
void sessionCreated (int sessionId)
 
void sessionSaved (int sessionId)
 
void sessionDeleted (int sessionId)
 
void sessionsSwapped (int sessionIdMin, int sessionIdMax)
 
void sessionRenamed (int sessionId)
 

Public Member Functions

 ~KateSessionManager ()
 
void saveConfig (bool saveSessions)
 
const int getStartupOption ()
 
const int getSwitchOption ()
 
void setSwitchOption (int option)
 
const TQString & getBaseDir () const
 
int getSessionCount () const
 
int getActiveSessionId () const
 
const TQString & getActiveSessionName ()
 
const TQString & getSessionName (int sessionId)
 
KateSession * getActiveSession ()
 
KateSession * getSessionFromId (int sessionId)
 
int getSessionIdFromName (const TQString &name)
 
TQPtrList< KateSession > & getSessionsList ()
 
bool activateSession (int sessionId, bool saveCurr=true)
 
int newSession (const TQString &sessionName=TQString::null, bool saveCurr=true)
 
int cloneSession (int sessionId, const TQString &sessionName=TQString::null, bool activate=true, bool deleteCurr=false)
 
void reloadActiveSession ()
 
bool restoreLastSession ()
 
void saveActiveSession ()
 
void saveSession (int sessionId)
 
bool deleteSession (int sessionId, int actSessId)
 
void moveSessionForward (int sessionId)
 
void moveSessionBackward (int sessionId)
 
void renameSession (int sessionId, const TQString &newSessionName)
 
void setSessionReadOnlyStatus (int sessionId, bool readOnly)
 

Static Public Member Functions

static KateSessionManager * self ()
 

Protected Types

enum  { SO_STARTUP = 0 , SO_SWITCH , SO_ALL }
 

Protected Member Functions

void updateSessionOptions (int optionType)
 
void saveSessionOptions (int optionType)
 
void swapSessionsPosition (int sessionId1, int sessionId2)
 
void saveSession (int sessionId, bool saveGUIInfo, bool setReadOnly=false)
 

Protected Attributes

TQString m_baseDir
 
TQString m_configFile
 
int m_activeSessionId
 
int m_lastSessionId
 
TQPtrList< KateSession > m_sessions
 
KSimpleConfig * m_config
 
int m_startupOption
 
int m_switchOption
 

Static Protected Attributes

static KateSessionManager * ksm_instance = NULL
 

Detailed Description

The Kate session manager.

It takes care of storing and retrieving each session object as well as providing methods to operate on them.

Note
The Kate session manager takes ownership of each session object it handles.

Definition at line 176 of file katesession.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 182 of file katesession.h.

◆ anonymous enum

anonymous enum

Definition at line 188 of file katesession.h.

◆ anonymous enum

anonymous enum

Definition at line 196 of file katesession.h.

◆ anonymous enum

anonymous enum
protected

Definition at line 435 of file katesession.h.

Constructor & Destructor Documentation

◆ ~KateSessionManager()

KateSessionManager::~KateSessionManager ( )

Destructor.

Definition at line 385 of file katesession.cpp.

◆ KateSessionManager()

KateSessionManager::KateSessionManager ( )
protected

Definition at line 331 of file katesession.cpp.

Member Function Documentation

◆ activateSession()

bool KateSessionManager::activateSession ( int  sessionId,
bool  saveCurr = true 
)

Activate the selected session.

Parameters
sessionIdthe id of the session to activate
saveCurrif true, save the current session before activating the new one
Returns
whether the session was activated or not @emit sessionActivated

Definition at line 583 of file katesession.cpp.

◆ cloneSession()

int KateSessionManager::cloneSession ( int  sessionId,
const TQString &  sessionName = TQString::null,
bool  activate = true,
bool  deleteCurr = false 
)

Create a new session and activate it if required.

Parameters
sessionIdthe id of the session to clone
sessionNamethe new session name
activateif true, activate the new session after creation
deleteCurrif true, delete the current session after switching
Returns
the id of the newly created session @emit sessionCreated

Definition at line 646 of file katesession.cpp.

◆ deleteSession()

bool KateSessionManager::deleteSession ( int  sessionId,
int  actSessId 
)
Delete the specified session
@param sessionId the id of the session to delete
@param actSessId the id of the next session to activate.
       If INVALID_SESSION or invalid, create a new empty session.
       This is only meaningful when deleting the current active session.
Returns
whether the session has been deleted or not @emit sessionDeleted

Definition at line 694 of file katesession.cpp.

◆ getActiveSession()

KateSession * KateSessionManager::getActiveSession ( )
inline
Returns
a reference to the active session

Definition at line 269 of file katesession.h.

◆ getActiveSessionId()

int KateSessionManager::getActiveSessionId ( ) const
inline
Returns
the active session id

Definition at line 253 of file katesession.h.

◆ getActiveSessionName()

const TQString & KateSessionManager::getActiveSessionName ( )
inline
Returns
the active session name

Definition at line 258 of file katesession.h.

◆ getBaseDir()

const TQString & KateSessionManager::getBaseDir ( ) const
inline
Returns
the session files folder name

Definition at line 243 of file katesession.h.

◆ getSessionCount()

int KateSessionManager::getSessionCount ( ) const
inline
Returns
the number of existing sessions

Definition at line 248 of file katesession.h.

◆ getSessionFromId()

KateSession * KateSessionManager::getSessionFromId ( int  sessionId)
Parameters
sessionIdthe id of the session to return
Returns
a reference to the specified session

Definition at line 557 of file katesession.cpp.

◆ getSessionIdFromName()

int KateSessionManager::getSessionIdFromName ( const TQString &  name)

Return the session id of the first session whose name matches the provided one.

In case multiple sessions share the same name, the id of the first one found will be returned.

Parameters
namethe session name to look for
Returns
the session id of the matching session if it is found, otherwise KateSessionManager::INVALID_SESSION.

Definition at line 568 of file katesession.cpp.

◆ getSessionName()

const TQString & KateSessionManager::getSessionName ( int  sessionId)
Parameters
sessionIdthe id of the session of interest
Returns
the name of the specified session

Definition at line 546 of file katesession.cpp.

◆ getSessionsList()

TQPtrList< KateSession > & KateSessionManager::getSessionsList ( )
inline
Returns
a reference to the sessions list

Definition at line 290 of file katesession.h.

◆ getStartupOption()

const int KateSessionManager::getStartupOption ( )
Returns
the session startup option The function checks the config file to see if there was any value update

Definition at line 524 of file katesession.cpp.

◆ getSwitchOption()

const int KateSessionManager::getSwitchOption ( )
Returns
the session switch option The function checks the config file to see if there was any value update

Definition at line 531 of file katesession.cpp.

◆ moveSessionBackward()

void KateSessionManager::moveSessionBackward ( int  sessionId)

Move the specified session backward in the session list (by one position)

Parameters
sessionIdthe id of the session to move

Definition at line 783 of file katesession.cpp.

◆ moveSessionForward()

void KateSessionManager::moveSessionForward ( int  sessionId)

Move the specified session forward in the session list (by one position)

Parameters
sessionIdthe id of the session to move

Definition at line 772 of file katesession.cpp.

◆ newSession()

int KateSessionManager::newSession ( const TQString &  sessionName = TQString::null,
bool  saveCurr = true 
)
Create a new session and activate it
@param sessionName new session name
@param saveCurr if true, save the current session before activating the new one
@return the id of the newly created session
@emit sessionCreated

@emit sessionDeleted (only when leaving an unstored and unnamed session)

Definition at line 636 of file katesession.cpp.

◆ reloadActiveSession()

void KateSessionManager::reloadActiveSession ( )
inline

Restore the current active session to the last saved state.

Definition at line 326 of file katesession.h.

◆ renameSession()

void KateSessionManager::renameSession ( int  sessionId,
const TQString &  newSessionName 
)
Rename the specified session
@param sessionId the id of the session to rename
@param newSessionName the new session name

@emit sessionRenamed

Definition at line 794 of file katesession.cpp.

◆ restoreLastSession()

bool KateSessionManager::restoreLastSession ( )

Restore the last saved session.

Can only be used before any other session has been activated, i.e. on Kate's startup

Returns
whether the session was activated or not

Definition at line 673 of file katesession.cpp.

◆ saveActiveSession()

void KateSessionManager::saveActiveSession ( )
inline
Saves the active session

@emit sessionSaved (through invoked "void saveSession(int)" method)

Definition at line 339 of file katesession.h.

◆ saveConfig()

void KateSessionManager::saveConfig ( bool  saveSessions)

Save session manager info.

Parameters
saveSessionstrue = sessions info will be saved false = all sessions will be discarded

Definition at line 481 of file katesession.cpp.

◆ saveSession() [1/2]

void KateSessionManager::saveSession ( int  sessionId)
inline
Save the specified session
@param sessionId the id of the session to save

@emit sessionSaved

Definition at line 346 of file katesession.h.

◆ saveSession() [2/2]

void KateSessionManager::saveSession ( int  sessionId,
bool  saveGUIInfo,
bool  setReadOnly = false 
)
protected
Save the specified session
@param sessionId the id of the session to save
@param saveGUIInfo if true, save also the information about the GUI elements
@param setReadOnly necessary to save a session that has to be turned to read only

@emit sessionSaved

Definition at line 683 of file katesession.cpp.

◆ saveSessionOptions()

void KateSessionManager::saveSessionOptions ( int  optionType)
protected

Save the session startup and switch options to the config file.

Parameters
optionTypespecifies which options needs to be saved

Definition at line 442 of file katesession.cpp.

◆ self()

KateSessionManager * KateSessionManager::self ( )
static

get a pointer to the unique KateSessionManager instance.

If the manager does not exist yet, create it.

Definition at line 321 of file katesession.cpp.

◆ sessionActivated

void KateSessionManager::sessionActivated ( int  newSessionId,
int  oldSessionId 
)
signal

Emitted once a session has been activated.

Parameters
newSessionIdthe id of the previous active session
oldSessionIdthe id of the new active session

◆ sessionCreated

void KateSessionManager::sessionCreated ( int  sessionId)
signal

Emitted once a session has been created.

Parameters
sessionIdthe id of the new session

◆ sessionDeleted

void KateSessionManager::sessionDeleted ( int  sessionId)
signal

Emitted once a session has been deleted.

Parameters
sessionIdthe id of the deleted session

◆ sessionRenamed

void KateSessionManager::sessionRenamed ( int  sessionId)
signal

Emitted once a session has been renamed.

Parameters
sessionIdthe id of the new session

◆ sessionSaved

void KateSessionManager::sessionSaved ( int  sessionId)
signal

Emitted once a session has been saved.

Parameters
sessionIdthe id of the saved session

◆ sessionsSwapped

void KateSessionManager::sessionsSwapped ( int  sessionIdMin,
int  sessionIdMax 
)
signal

Emitted once the position of the two sessions have been swapped.

Parameters
sessionIdMinthe smallest id of the session couple
sessionIdMaxthe biggest id of the session couple

◆ setSessionReadOnlyStatus()

void KateSessionManager::setSessionReadOnlyStatus ( int  sessionId,
bool  readOnly 
)

Set the read only status of the specified session.

Parameters
sessionIdthe id of the session to modify
readOnlythe new read only status

Definition at line 806 of file katesession.cpp.

◆ setSwitchOption()

void KateSessionManager::setSwitchOption ( int  option)

Set the new session switch preference.

Parameters
optionthe new option value. Defaults to SWITCH_ASK if the value is invalid. @emit switchOptionChanged

Definition at line 538 of file katesession.cpp.

◆ swapSessionsPosition()

void KateSessionManager::swapSessionsPosition ( int  sessionId1,
int  sessionId2 
)
protected

Swap the position of the two specified sessions in the session list.

Parameters
sessionId1the id of the first session
sessionId2the id of the second session @emit sessionsSwapped

Definition at line 734 of file katesession.cpp.

◆ switchOptionChanged

void KateSessionManager::switchOptionChanged ( )
signal

Emitted when the session switch option has been set/changed.

◆ updateSessionOptions()

void KateSessionManager::updateSessionOptions ( int  optionType)
protected

Updated the session startup and switch options.

Parameters
optionTypespecifies which options needs to be updated

Definition at line 395 of file katesession.cpp.

Member Data Documentation

◆ ksm_instance

KateSessionManager * KateSessionManager::ksm_instance = NULL
staticprotected

Definition at line 481 of file katesession.h.

◆ m_activeSessionId

int KateSessionManager::m_activeSessionId
protected

Definition at line 474 of file katesession.h.

◆ m_baseDir

TQString KateSessionManager::m_baseDir
protected

Definition at line 472 of file katesession.h.

◆ m_config

KSimpleConfig* KateSessionManager::m_config
protected

Definition at line 477 of file katesession.h.

◆ m_configFile

TQString KateSessionManager::m_configFile
protected

Definition at line 473 of file katesession.h.

◆ m_lastSessionId

int KateSessionManager::m_lastSessionId
protected

Definition at line 475 of file katesession.h.

◆ m_sessions

TQPtrList<KateSession> KateSessionManager::m_sessions
protected

Definition at line 476 of file katesession.h.

◆ m_startupOption

int KateSessionManager::m_startupOption
protected

Definition at line 478 of file katesession.h.

◆ m_switchOption

int KateSessionManager::m_switchOption
protected

Definition at line 479 of file katesession.h.


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

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.9.4
This website is maintained by Timothy Pearson.