@ -31,6 +31,8 @@
# include <tqvaluelist.h>
# include <tqstringlist.h>
class KateViewSpace ;
class OldKateSessionManager ; // Michele - to be removed with OldKateSession
class KDirWatch ;
@ -85,9 +87,9 @@ class KateSession
/**
* Save session info
* @ param saveDocList if true , save also the information about the documents currently open
* @ param saveGUIInfo if true , save also the information about the GUI elements
*/
void save ( bool saveDocList ) ;
void save ( bool saveGUIInfo ) ;
/**
* Activate the session
@ -95,6 +97,14 @@ class KateSession
void activate ( ) ;
private :
friend class KateViewSpace ;
/**
* @ return the session config object
*/
TDEConfig * getConfig ( ) { return m_config ; }
TQString m_sessionName ;
TQString m_filename ;
bool m_isFullName ; // true -> m_filename is a full filename
@ -112,6 +122,11 @@ class KateSessionManager
{
public :
enum
{
INVALID_SESSION = - 1
} ;
/**
* get a pointer to the unique KateSessionManager instance .
* If the manager does not exist yet , create it .
@ -133,6 +148,11 @@ class KateSessionManager
*/
int getActiveSessionId ( ) const { return m_activeSessionId ; }
/**
* @ return the active session name
*/
const TQString & getActiveSessionName ( ) /*FIXME const*/ { return m_sessions [ m_activeSessionId ] - > getSessionName ( ) ; }
/**
* @ return a reference to the active session
*/
@ -143,6 +163,15 @@ class KateSessionManager
*/
TQPtrList < KateSession > & getSessionsList ( ) { return m_sessions ; }
/**
* Returns the session id of the first session whose name matches the
* provided one
* @ param name the session name to look for
* @ return the session id of the matching session if it is found ,
* otherwise KateSessionManager : : INVALID_SESSION .
*/
int getSessionIdFromName ( const TQString & name ) ;
/**
* Activates the selected session .
* @ param sessionId the id of the session to activate
@ -151,6 +180,18 @@ class KateSessionManager
*/
bool activateSession ( int sessionId , bool saveCurr = true ) ;
/**
* Restore the last saved session . Can only be used before
* any other session has been activated , i . e . on Kate ' s startup
* @ return whether the session was activated or not
*/
bool restoreLastSession ( ) ;
/**
* Saves the active session
*/
void saveActiveSession ( ) { m_sessions [ m_activeSessionId ] - > save ( true ) ; }
private :
KateSessionManager ( ) ;
@ -158,6 +199,7 @@ class KateSessionManager
TQString m_configFile ; // file where the session list config is stored
int m_sessionsCount ; // number of sessions
int m_activeSessionId ; // index of the active session
bool m_firstActivation ; // true until at least one session has been activated
TQPtrList < KateSession > m_sessions ; // session list
KSimpleConfig * m_config ; // session manager config
@ -186,7 +228,7 @@ class OldKateSession : public TDEShared
* @ param name session name
* @ param manager pointer to the manager
*/
OldKateSession ( OldKateSessionManager * manager , const TQString & fileName , const TQString & name ) ;
OldKateSession ( OldKateSessionManager * manager , const TQString & fileName , const TQString & name ) ;
/**
* init the session object , after construction or create
@ -228,14 +270,14 @@ class OldKateSession : public TDEShared
* @ param force force to create new file
* @ return true if created , false if no creation needed
*/
bool create ( const TQString & name , bool force = false ) ;
bool create ( const TQString & name , bool force = false ) ;
/**
* rename this session
* @ param name new name
* @ return success
*/
bool rename ( const TQString & name ) ;
bool rename ( const TQString & name ) ;
/**
* config to read
@ -299,7 +341,7 @@ class OldKateSessionManager : public TQObject
Q_OBJECT
public :
OldKateSessionManager ( TQObject * parent ) ;
OldKateSessionManager ( TQObject * parent ) ;
~ OldKateSessionManager ( ) ;
/**
@ -323,20 +365,20 @@ class OldKateSessionManager : public TQObject
* @ param saveLast try to save last session or not ?
* @ param loadNew load new session stuff ?
*/
void activateSession ( OldKateSession : : Ptr session , bool closeLast = true , bool saveLast = true , bool loadNew = true ) ;
void activateSession ( OldKateSession : : Ptr session , bool closeLast = true , bool saveLast = true , bool loadNew = true ) ;
/**
* create a new session
* @ param name session name
*/
OldKateSession : : Ptr createSession ( const TQString & name ) ;
OldKateSession : : Ptr createSession ( const TQString & name ) ;
/**
* return session with given name
* if no existing session matches , create new one with this name
* @ param name session name
*/
OldKateSession : : Ptr giveSession ( const TQString & name ) ;
OldKateSession : : Ptr giveSession ( const TQString & name ) ;
/**
* save current session
@ -345,7 +387,7 @@ class OldKateSessionManager : public TQObject
* @ param rememberAsLast remember this session as last used ?
* @ return success
*/
bool saveActiveSession ( bool tryAsk = false , bool rememberAsLast = false ) ;
bool saveActiveSession ( bool tryAsk = false , bool rememberAsLast = false ) ;
/**
* return the current active session
@ -394,7 +436,7 @@ class OldKateSessionManager : public TQObject
void sessionManage ( ) ;
private slots :
void dirty ( const TQString & path ) ;
void dirty ( const TQString & path ) ;
public :
/**
@ -424,14 +466,15 @@ class OldKateSessionChooser : public KDialogBase
Q_OBJECT
public :
OldKateSessionChooser ( TQWidget * parent , const TQString & lastSession ) ;
OldKateSessionChooser ( TQWidget * parent , const TQString & lastSession ) ;
~ OldKateSessionChooser ( ) ;
OldKateSession : : Ptr selectedSession ( ) ;
bool reopenLastSession ( ) ;
enum {
enum
{
resultQuit = TQDialog : : Rejected ,
resultOpen ,
resultNew ,
@ -469,12 +512,13 @@ class OldKateSessionOpenDialog : public KDialogBase
Q_OBJECT
public :
OldKateSessionOpenDialog ( TQWidget * parent ) ;
OldKateSessionOpenDialog ( TQWidget * parent ) ;
~ OldKateSessionOpenDialog ( ) ;
OldKateSession : : Ptr selectedSession ( ) ;
enum {
enum
{
resultOk ,
resultCancel
} ;
@ -499,7 +543,7 @@ class OldKateSessionManageDialog : public KDialogBase
Q_OBJECT
public :
OldKateSessionManageDialog ( TQWidget * parent ) ;
OldKateSessionManageDialog ( TQWidget * parent ) ;
~ OldKateSessionManageDialog ( ) ;
protected slots :
@ -540,13 +584,13 @@ class OldKateSessionsAction : public TDEActionMenu
Q_OBJECT
public :
OldKateSessionsAction ( const TQString & text , TQObject * parent = 0 , const char * name = 0 ) ;
~ OldKateSessionsAction ( ) { ; } ;
OldKateSessionsAction ( const TQString & text , TQObject * parent = 0 , const char * name = 0 ) ;
~ OldKateSessionsAction ( ) { ; } ;
public slots :
void slotAboutToShow ( ) ;
void openSession ( int i ) ;
void openSession ( int i ) ;
} ;
# endif