• 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
  • swapfile
kateswapfile.h
Go to the documentation of this file.
1 /* This file is part of the Kate project.
2  *
3  * Copyright (C) 2010 Dominik Haumann <dhaumann kde org>
4  * Copyright (C) 2010 Diana-Victoria Tiriplica <diana.tiriplica@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef KATE_SWAPFILE_H
23 #define KATE_SWAPFILE_H
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QDataStream>
27 #include <QFile>
28 #include <QTimer>
29 
30 #include "katepartprivate_export.h"
31 #include "katetextbuffer.h"
32 #include "katebuffer.h"
33 #include "katedocument.h"
34 
35 #include <ktexteditor/messageinterface.h>
36 
37 class KateView;
38 
39 namespace Kate {
40 
46 class KATEPART_TESTS_EXPORT SwapFile : public QObject
47 {
48  Q_OBJECT
49 
50  public:
51  explicit SwapFile(KateDocument* document);
52  ~SwapFile();
53  bool shouldRecover() const;
54 
55  void fileClosed ();
56  QString fileName();
57 
58  KateDocument* document();
59 
60  private:
61  void setTrackingEnabled(bool trackingEnabled);
62  void removeSwapFile();
63  bool updateFileName();
64  bool isValidSwapFile(QDataStream& stream, bool checkDigest) const;
65 
66  private:
67  KateDocument *m_document;
68  bool m_trackingEnabled;
69 
70  protected Q_SLOTS:
71  void fileSaved(const QString& filename);
72  void fileLoaded(const QString &filename);
73  void modifiedChanged();
74 
75  void startEditing ();
76  void finishEditing ();
77 
78  void wrapLine (const KTextEditor::Cursor &position);
79  void unwrapLine (int line);
80  void insertText (const KTextEditor::Cursor &position, const QString &text);
81  void removeText (const KTextEditor::Range &range);
82 
83  public Q_SLOTS:
84  void discard();
85  void recover();
86  bool recover(QDataStream&, bool checkDigest = true);
87  void configChanged();
88 
89  private:
90  QDataStream m_stream;
91  QFile m_swapfile;
92  bool m_recovered;
93  bool m_needSync;
94  static QTimer *s_timer;
95 
96  protected Q_SLOTS:
97  void writeFileToDisk();
98 
99  private:
100  QTimer* syncTimer();
101 
102  public Q_SLOTS:
103  void showSwapFileMessage();
104  void showDiff();
105 
106  private:
107  QPointer<KTextEditor::Message> m_swapMessage;
108 };
109 
110 }
111 
112 #endif // KATE_SWAPFILE_H
113 
114 // kate: space-indent on; indent-width 2; replace-tabs on;
katetextbuffer.h
QDataStream
QPointer< KTextEditor::Message >
katedocument.h
KATEPART_TESTS_EXPORT
#define KATEPART_TESTS_EXPORT
Definition: katepartprivate_export.h:36
QFile
katebuffer.h
QTimer
Kate::SwapFile
Class for tracking editing actions.
Definition: kateswapfile.h:46
QObject
katepartprivate_export.h
QString
KateView
Definition: kateview.h:77
KateDocument
Definition: katedocument.h:74
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