• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • undo
kateundomanager.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2009-2010 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
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 KATEUNDOMANAGER_H
20 #define KATEUNDOMANAGER_H
21 
22 #include <QtCore/QObject>
23 
24 #include "katepartprivate_export.h"
25 
26 #include <QtCore/QList>
27 
28 class KateDocument;
29 class KateUndo;
30 class KateUndoGroup;
31 
32 namespace KTextEditor {
33  class Document;
34  class View;
35  class Cursor;
36 }
37 
45 class KATEPART_TESTS_EXPORT KateUndoManager : public QObject
46 {
47  Q_OBJECT
48 
49  public:
55  KateUndoManager (KateDocument *doc);
56 
57  ~KateUndoManager();
58 
59  KTextEditor::Document *document();
60 
66  uint undoCount () const;
67 
73  uint redoCount () const;
74 
78  void undoSafePoint();
79 
88  void setAllowComplexMerge(bool allow);
89 
90  bool isActive() const { return m_isActive; }
91 
92  void setModified( bool modified );
93  void updateConfig ();
94  void updateLineModifications();
95 
103  void setUndoRedoCursorsOfLastGroup(const KTextEditor::Cursor undoCursor,
104  const KTextEditor::Cursor redoCursor);
105 
110  KTextEditor::Cursor lastRedoCursor() const;
111 
112  public Q_SLOTS:
118  void undo ();
119 
125  void redo ();
126 
127  void clearUndo ();
128  void clearRedo ();
129 
133  void editStart();
134 
138  void editEnd();
139 
140  void startUndo();
141  void endUndo();
142 
143  void inputMethodStart();
144  void inputMethodEnd();
145 
149  void slotTextInserted(int line, int col, const QString &s);
150 
154  void slotTextRemoved(int line, int col, const QString &s);
155 
159  void slotMarkLineAutoWrapped(int line, bool autowrapped);
160 
164  void slotLineWrapped(int line, int col, int length, bool newLine);
165 
169  void slotLineUnWrapped(int line, int col, int length, bool lineRemoved);
170 
174  void slotLineInserted(int line, const QString &s);
175 
179  void slotLineRemoved(int line, const QString &s);
180 
181  Q_SIGNALS:
182  void undoChanged ();
183  void undoStart (KTextEditor::Document*);
184  void undoEnd (KTextEditor::Document*);
185  void redoStart (KTextEditor::Document*);
186  void redoEnd (KTextEditor::Document*);
187  void isActiveChanged(bool enabled);
188 
189  private Q_SLOTS:
195  void addUndoItem(KateUndo *undo);
196 
197  void setActive(bool active);
198 
199  void updateModified();
200 
201  void undoCancel();
202  void viewCreated (KTextEditor::Document *, KTextEditor::View *newView);
203 
204  private:
205  KTextEditor::View *activeView();
206 
207  private:
208  KateDocument *m_document;
209  bool m_undoComplexMerge;
210  bool m_isActive;
211  KateUndoGroup* m_editCurrentUndo;
212  QList<KateUndoGroup*> undoItems;
213  QList<KateUndoGroup*> redoItems;
214  // these two variables are for resetting the document to
215  // non-modified if all changes have been undone...
216  KateUndoGroup* lastUndoGroupWhenSaved;
217  KateUndoGroup* lastRedoGroupWhenSaved;
218  bool docWasSavedWhenUndoWasEmpty;
219  bool docWasSavedWhenRedoWasEmpty;
220 };
221 
222 #endif
223 
224 // kate: space-indent on; indent-width 2; replace-tabs on;
KATEPART_TESTS_EXPORT
#define KATEPART_TESTS_EXPORT
Definition: katepartprivate_export.h:36
KateUndoManager
KateUndoManager implements a document's history.
Definition: kateundomanager.h:45
KateUndoGroup
Class to manage a group of undo items.
Definition: kateundo.h:378
QObject
katepartprivate_export.h
QString
QList< KateUndoGroup * >
KateDocument
Definition: katedocument.h:74
KateUndoManager::isActive
bool isActive() const
Definition: kateundomanager.h:90
KateUndo
Base class for Kate undo commands.
Definition: kateundo.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal