19 #ifndef __KATE_SESSION_H__
20 #define __KATE_SESSION_H__
24 #include <kdialogbase.h>
25 #include <ksimpleconfig.h>
26 #include <ksharedptr.h>
27 #include <tdeaction.h>
30 #include <tqvaluelist.h>
32 class KateSessionManager;
40 class KateSession :
public TDEShared
46 typedef TDESharedPtr<KateSession> Ptr;
55 KateSession (KateSessionManager *manager,
const TQString &fileName,
const TQString &name);
71 TQString sessionFile ()
const;
77 const TQString &sessionFileRelative ()
const {
return m_sessionFileRel; }
83 const TQString &sessionName ()
const {
return m_sessionName; }
89 bool isNew ()
const {
return m_sessionName.isEmpty(); }
97 bool create (
const TQString &name,
bool force =
false);
104 bool rename (
const TQString &name);
112 TDEConfig *configRead ();
120 TDEConfig *configWrite ();
126 unsigned int documents ()
const {
return m_documents; }
133 TQString m_sessionFileRel;
138 TQString m_sessionName;
143 unsigned int m_documents;
148 KateSessionManager *m_manager;
153 KSimpleConfig *m_readConfig;
158 KSimpleConfig *m_writeConfig;
161 typedef TQValueList<KateSession::Ptr> KateSessionList;
163 class KateSessionManager :
public TQObject
168 KateSessionManager(TQObject *parent);
169 ~KateSessionManager();
175 static KateSessionManager *
self();
181 inline KateSessionList & sessionList () { updateSessionList ();
return m_sessionList; }
192 void activateSession (KateSession::Ptr session,
bool closeLast =
true,
bool saveLast =
true,
bool loadNew =
true);
198 KateSession::Ptr createSession (
const TQString &name);
205 KateSession::Ptr giveSession (
const TQString &name);
214 bool saveActiveSession (
bool tryAsk =
false,
bool rememberAsLast =
false);
221 inline KateSession::Ptr activeSession () {
return m_activeSession; }
227 inline const TQString &sessionsDir ()
const {
return m_sessionsDir; }
233 bool chooseSession ();
255 void sessionSaveAs ();
260 void sessionManage ();
263 void dirty (
const TQString &path);
269 void updateSessionList ();
275 TQString m_sessionsDir;
280 KateSessionList m_sessionList;
285 KateSession::Ptr m_activeSession;
288 class KateSessionChooser :
public KDialogBase
293 KateSessionChooser (TQWidget *parent,
const TQString &lastSession);
294 ~KateSessionChooser ();
296 KateSession::Ptr selectedSession ();
298 bool reopenLastSession ();
301 resultQuit = TQDialog::Rejected,
326 void selectionChanged ();
329 TDEListView *m_sessions;
330 TQCheckBox *m_useLast;
333 class KateSessionOpenDialog :
public KDialogBase
338 KateSessionOpenDialog (TQWidget *parent);
339 ~KateSessionOpenDialog ();
341 KateSession::Ptr selectedSession ();
360 TDEListView *m_sessions;
363 class KateSessionManageDialog :
public KDialogBase
368 KateSessionManageDialog (TQWidget *parent);
369 ~KateSessionManageDialog ();
380 void selectionChanged ();
396 void updateSessionList ();
399 TDEListView *m_sessions;
400 KPushButton *m_rename;
404 class KateSessionsAction :
public TDEActionMenu
409 KateSessionsAction(
const TQString& text, TQObject* parent = 0,
const char* name = 0);
410 ~KateSessionsAction (){;};
413 void slotAboutToShow();
415 void openSession (
int i);