#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.
Constructor & Destructor Documentation
◆ ~KateSessionManager()
KateSessionManager::~KateSessionManager | ( | ) |
Destructor.
Definition at line 385 of file katesession.cpp.
Member Function Documentation
◆ activateSession()
bool KateSessionManager::activateSession | ( | int | sessionId, |
bool | saveCurr = true |
||
) |
Activate the selected session.
- Parameters
-
sessionId the id of the session to activate saveCurr if 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
-
sessionId the id of the session to clone sessionName the new session name activate if true, activate the new session after creation deleteCurr if 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()
|
inline |
- Returns
- a reference to the active session
Definition at line 269 of file katesession.h.
◆ getActiveSessionId()
|
inline |
- Returns
- the active session id
Definition at line 253 of file katesession.h.
◆ getActiveSessionName()
|
inline |
- Returns
- the active session name
Definition at line 258 of file katesession.h.
◆ getBaseDir()
|
inline |
- Returns
- the session files folder name
Definition at line 243 of file katesession.h.
◆ getSessionCount()
|
inline |
- Returns
- the number of existing sessions
Definition at line 248 of file katesession.h.
◆ getSessionFromId()
KateSession * KateSessionManager::getSessionFromId | ( | int | sessionId | ) |
- Parameters
-
sessionId the 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
-
name the 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
-
sessionId the id of the session of interest
- Returns
- the name of the specified session
Definition at line 546 of file katesession.cpp.
◆ 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
-
sessionId the 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
-
sessionId the 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()
|
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()
|
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
-
saveSessions true = sessions info will be saved false = all sessions will be discarded
Definition at line 481 of file katesession.cpp.
◆ saveSession() [1/2]
|
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]
|
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()
|
protected |
Save the session startup and switch options to the config file.
- Parameters
-
optionType specifies which options needs to be saved
Definition at line 442 of file katesession.cpp.
◆ 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
|
signal |
Emitted once a session has been activated.
- Parameters
-
newSessionId the id of the previous active session oldSessionId the id of the new active session
◆ sessionCreated
|
signal |
Emitted once a session has been created.
- Parameters
-
sessionId the id of the new session
◆ sessionDeleted
|
signal |
Emitted once a session has been deleted.
- Parameters
-
sessionId the id of the deleted session
◆ sessionRenamed
|
signal |
Emitted once a session has been renamed.
- Parameters
-
sessionId the id of the new session
◆ sessionSaved
|
signal |
Emitted once a session has been saved.
- Parameters
-
sessionId the id of the saved session
◆ sessionsSwapped
|
signal |
Emitted once the position of the two sessions have been swapped.
- Parameters
-
sessionIdMin the smallest id of the session couple sessionIdMax the biggest id of the session couple
◆ setSessionReadOnlyStatus()
void KateSessionManager::setSessionReadOnlyStatus | ( | int | sessionId, |
bool | readOnly | ||
) |
Set the read only status of the specified session.
- Parameters
-
sessionId the id of the session to modify readOnly the 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
-
option the new option value. Defaults to SWITCH_ASK if the value is invalid. @emit switchOptionChanged
Definition at line 538 of file katesession.cpp.
◆ swapSessionsPosition()
|
protected |
Swap the position of the two specified sessions in the session list.
- Parameters
-
sessionId1 the id of the first session sessionId2 the id of the second session @emit sessionsSwapped
Definition at line 734 of file katesession.cpp.
◆ switchOptionChanged
|
signal |
Emitted when the session switch option has been set/changed.
◆ updateSessionOptions()
|
protected |
Updated the session startup and switch options.
- Parameters
-
optionType specifies which options needs to be updated
Definition at line 395 of file katesession.cpp.
The documentation for this class was generated from the following files: