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

KDECore

  • 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
96class KDECORE_EXPORT KSaveFile : public QFile
97{
98public:
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
304private:
305 Q_DISABLE_COPY(KSaveFile)
306
307 class Private;
308 Private *const d;
309};
310
311#endif
KComponentData
Per component data.
Definition: kcomponentdata.h:47
KSaveFile
Class to allow for atomic file I/O, as well as utility functions.
Definition: ksavefile.h:97
QString
kdecore_export.h
kglobal.h
KGlobal::mainComponent
const KComponentData & mainComponent()
Returns the global component data.
Definition: kglobal.cpp:145
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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