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

kate

  • kate
  • app
katesession.h
1 /* This file is part of the KDE project
2  Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef __KATE_SESSION_H__
20 #define __KATE_SESSION_H__
21 
22 #include "katemain.h"
23 
24 #include <kdialogbase.h>
25 #include <ksimpleconfig.h>
26 #include <ksharedptr.h>
27 #include <tdeaction.h>
28 
29 #include <tqobject.h>
30 #include <tqvaluelist.h>
31 
32 class KateSessionManager;
33 
34 class KDirWatch;
35 class TDEListView;
36 class KPushButton;
37 
38 class TQCheckBox;
39 
40 class KateSession : public TDEShared
41 {
42  public:
46  typedef TDESharedPtr<KateSession> Ptr;
47 
48  public:
55  KateSession (KateSessionManager *manager, const TQString &fileName, const TQString &name);
56 
60  void init ();
61 
65  ~KateSession ();
66 
71  TQString sessionFile () const;
72 
77  const TQString &sessionFileRelative () const { return m_sessionFileRel; }
78 
83  const TQString &sessionName () const { return m_sessionName; }
84 
89  bool isNew () const { return m_sessionName.isEmpty(); }
90 
97  bool create (const TQString &name, bool force = false);
98 
104  bool rename (const TQString &name);
105 
112  TDEConfig *configRead ();
113 
120  TDEConfig *configWrite ();
121 
126  unsigned int documents () const { return m_documents; }
127 
128  private:
133  TQString m_sessionFileRel;
134 
138  TQString m_sessionName;
139 
143  unsigned int m_documents;
144 
148  KateSessionManager *m_manager;
149 
153  KSimpleConfig *m_readConfig;
154 
158  KSimpleConfig *m_writeConfig;
159 };
160 
161 typedef TQValueList<KateSession::Ptr> KateSessionList;
162 
163 class KateSessionManager : public TQObject
164 {
165  Q_OBJECT
166 
167  public:
168  KateSessionManager(TQObject *parent);
169  ~KateSessionManager();
170 
175  static KateSessionManager *self();
176 
181  inline KateSessionList & sessionList () { updateSessionList (); return m_sessionList; }
182 
192  void activateSession (KateSession::Ptr session, bool closeLast = true, bool saveLast = true, bool loadNew = true);
193 
198  KateSession::Ptr createSession (const TQString &name);
199 
205  KateSession::Ptr giveSession (const TQString &name);
206 
214  bool saveActiveSession (bool tryAsk = false, bool rememberAsLast = false);
215 
221  inline KateSession::Ptr activeSession () { return m_activeSession; }
222 
227  inline const TQString &sessionsDir () const { return m_sessionsDir; }
228 
233  bool chooseSession ();
234 
235  public slots:
240  void sessionNew ();
241 
245  void sessionOpen ();
246 
250  void sessionSave ();
251 
255  void sessionSaveAs ();
256 
260  void sessionManage ();
261 
262  private slots:
263  void dirty (const TQString &path);
264 
265  public:
269  void updateSessionList ();
270 
271  private:
275  TQString m_sessionsDir;
276 
280  KateSessionList m_sessionList;
281 
285  KateSession::Ptr m_activeSession;
286 };
287 
288 class KateSessionChooser : public KDialogBase
289 {
290  Q_OBJECT
291 
292  public:
293  KateSessionChooser (TQWidget *parent, const TQString &lastSession);
294  ~KateSessionChooser ();
295 
296  KateSession::Ptr selectedSession ();
297 
298  bool reopenLastSession ();
299 
300  enum {
301  resultQuit = TQDialog::Rejected,
302  resultOpen,
303  resultNew,
304  resultNone
305  };
306 
307  protected slots:
311  void slotUser1 ();
312 
316  void slotUser2 ();
317 
321  void slotUser3 ();
322 
326  void selectionChanged ();
327 
328  private:
329  TDEListView *m_sessions;
330  TQCheckBox *m_useLast;
331 };
332 
333 class KateSessionOpenDialog : public KDialogBase
334 {
335  Q_OBJECT
336 
337  public:
338  KateSessionOpenDialog (TQWidget *parent);
339  ~KateSessionOpenDialog ();
340 
341  KateSession::Ptr selectedSession ();
342 
343  enum {
344  resultOk,
345  resultCancel
346  };
347 
348  protected slots:
352  void slotUser1 ();
353 
357  void slotUser2 ();
358 
359  private:
360  TDEListView *m_sessions;
361 };
362 
363 class KateSessionManageDialog : public KDialogBase
364 {
365  Q_OBJECT
366 
367  public:
368  KateSessionManageDialog (TQWidget *parent);
369  ~KateSessionManageDialog ();
370 
371  protected slots:
375  void slotUser1 ();
376 
380  void selectionChanged ();
381 
385  void rename ();
386 
390  void del ();
391 
392  private:
396  void updateSessionList ();
397 
398  private:
399  TDEListView *m_sessions;
400  KPushButton *m_rename;
401  KPushButton *m_del;
402 };
403 
404 class KateSessionsAction : public TDEActionMenu
405 {
406  Q_OBJECT
407 
408  public:
409  KateSessionsAction(const TQString& text, TQObject* parent = 0, const char* name = 0);
410  ~KateSessionsAction (){;};
411 
412  public slots:
413  void slotAboutToShow();
414 
415  void openSession (int i);
416 };
417 
418 #endif

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.8.1.2
This website is maintained by Timothy Pearson.