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

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • io
ksavefile.h
Go to the documentation of this file.
1 /* kate: tab-indents off; replace-tabs on; tab-width 4; remove-trailing-space on; encoding utf-8;*/
2 /*
3  This file is part of the KDE libraries
4  Copyright 1999 Waldo Bastian <bastian@kde.org>
5  Copyright 2006 Jaison Lee <lee.jaison@gmail.com>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License version 2 as published by the Free Software Foundation.
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 KSAVEFILE_H
23 #define KSAVEFILE_H
24 
25 #include <kdecore_export.h>
26 
27 #include <QtCore/QFile>
28 #include <QtCore/QString>
29 #include <kglobal.h>
30 
96 class KDECORE_EXPORT KSaveFile : public QFile
97 {
98 public:
102  KSaveFile();
103 
110  explicit KSaveFile(const QString &filename, const KComponentData &componentData = KGlobal::mainComponent()); // KDE5 TODO: remove KComponentData
111 
118  virtual ~KSaveFile();
119 
126  void setFileName(const QString &filename);
127 
134  QString fileName() const;
135 
141  QFile::FileError error() const;
142 
149  QString errorString() const;
150 
162  virtual bool open(OpenMode flags = QIODevice::ReadWrite);
163 
169  void abort();
170 
176  bool finalize();
177 
202  void setDirectWriteFallback(bool enabled);
203 
210  bool directWriteFallback() const;
211 
225  static bool backupFile( const QString& filename,
226  const QString& backupDir = QString() );
227 
239  static bool simpleBackupFile( const QString& filename,
240  const QString& backupDir = QString(),
241  const QString& backupExtension = QLatin1String( "~" ) );
242 
270  static bool numberedBackupFile( const QString& filename,
271  const QString& backupDir = QString(),
272  const QString& backupExtension = QString::fromLatin1( "~" ),
273  const uint maxBackups = 10
274  );
275 
276 
299  static bool rcsBackupFile( const QString& filename,
300  const QString& backupDir = QString(),
301  const QString& backupMessage = QString()
302  );
303 
304 private:
305  Q_DISABLE_COPY(KSaveFile)
306 
307  class Private;
308  Private *const d;
309 };
310 
311 #endif
kdecore_export.h
QIODevice::errorString
QString errorString() const
QFile::fileName
QString fileName() const
KSaveFile
Class to allow for atomic file I/O, as well as utility functions.
Definition: ksavefile.h:96
QFile::setFileName
void setFileName(const QString &name)
QFile::error
FileError error() const
QFile
kglobal.h
QString
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QLatin1String
KGlobal::mainComponent
const KComponentData & mainComponent()
Returns the global component data.
Definition: kglobal.cpp:145
QString::fromLatin1
QString fromLatin1(const char *str, int size)
KComponentData
Per component data.
Definition: kcomponentdata.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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

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