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

Kate

kateswapfile.h

Go to the documentation of this file.
00001 /*  This file is part of the Kate project.
00002  *
00003  *  Copyright (C) 2010 Dominik Haumann <dhaumann kde org>
00004  *  Copyright (C) 2010 Diana-Victoria Tiriplica <diana.tiriplica@gmail.com>
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public License
00017  *  along with this library; see the file COPYING.LIB.  If not, write to
00018  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  *  Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef KATE_SWAPFILE_H
00023 #define KATE_SWAPFILE_H
00024 
00025 #include <QtCore/QObject>
00026 #include <QtCore/QDataStream>
00027 #include <QFile>
00028 #include <QTimer>
00029 
00030 #include "katepartprivate_export.h"
00031 #include "katetextbuffer.h"
00032 #include "katebuffer.h"
00033 #include "katedocument.h"
00034 
00035 class KateView;
00036 
00037 namespace Kate {
00038 
00044 class KATEPART_TESTS_EXPORT SwapFile : public QObject
00045 {
00046   Q_OBJECT
00047 
00048   public:
00049     explicit SwapFile(KateDocument* document);
00050     ~SwapFile();
00051     bool shouldRecover() const;
00052     
00053     void fileClosed ();
00054     QString fileName();
00055 
00056   private:
00057     void setTrackingEnabled(bool trackingEnabled);
00058     void removeSwapFile();
00059     bool updateFileName();
00060 
00061   private:
00062     KateDocument *m_document;
00063     bool m_trackingEnabled;
00064 
00065   protected Q_SLOTS:
00066     void fileSaved(const QString& filename);
00067     void fileLoaded(const QString &filename);
00068 
00069     void startEditing ();
00070     void finishEditing ();
00071 
00072     void wrapLine (const KTextEditor::Cursor &position);
00073     void unwrapLine (int line);
00074     void insertText (const KTextEditor::Cursor &position, const QString &text);
00075     void removeText (const KTextEditor::Range &range);
00076     
00077   Q_SIGNALS:
00078     void swapFileFound();
00079     void swapFileHandled();
00080     void swapFileBroken();
00081   
00082   public Q_SLOTS:
00083     void discard();
00084     void recover();
00085     bool recover(QDataStream&);
00086     void configChanged();
00087 
00088   private:
00089     QDataStream m_stream;
00090     QFile m_swapfile;
00091     bool m_recovered;
00092     bool m_modified;
00093     static QTimer *s_timer;
00094 
00095   protected Q_SLOTS:
00096     void writeFileToDisk();
00097 
00098   private:
00099     QTimer* syncTimer();
00100 };
00101 
00102 }
00103 
00104 #endif // KATE_SWAPFILE_H
00105 
00106 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal