KDECore
ksavefile.h
Go to the documentation of this file.
00001 /* kate: tab-indents off; replace-tabs on; tab-width 4; remove-trailing-space on; encoding utf-8;*/ 00002 /* 00003 This file is part of the KDE libraries 00004 Copyright 1999 Waldo Bastian <bastian@kde.org> 00005 Copyright 2006 Jaison Lee <lee.jaison@gmail.com> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License version 2 as published by the Free Software Foundation. 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 KSAVEFILE_H 00023 #define KSAVEFILE_H 00024 00025 #include <kdecore_export.h> 00026 00027 #include <QtCore/QFile> 00028 #include <QtCore/QString> 00029 #include <kglobal.h> 00030 00096 class KDECORE_EXPORT KSaveFile : public QFile 00097 { 00098 public: 00102 KSaveFile(); 00103 00110 explicit KSaveFile(const QString &filename, const KComponentData &componentData = KGlobal::mainComponent()); 00111 00118 virtual ~KSaveFile(); 00119 00126 void setFileName(const QString &filename); 00127 00134 QString fileName() const; 00135 00141 QFile::FileError error() const; 00142 00149 QString errorString() const; 00150 00162 virtual bool open(OpenMode flags = QIODevice::ReadWrite); 00163 00169 void abort(); 00170 00176 bool finalize(); 00177 00191 static bool backupFile( const QString& filename, 00192 const QString& backupDir = QString() ); 00193 00205 static bool simpleBackupFile( const QString& filename, 00206 const QString& backupDir = QString(), 00207 const QString& backupExtension = QLatin1String( "~" ) ); 00208 00236 static bool numberedBackupFile( const QString& filename, 00237 const QString& backupDir = QString(), 00238 const QString& backupExtension = QString::fromLatin1( "~" ), 00239 const uint maxBackups = 10 00240 ); 00241 00242 00265 static bool rcsBackupFile( const QString& filename, 00266 const QString& backupDir = QString(), 00267 const QString& backupMessage = QString() 00268 ); 00269 00270 private: 00271 Q_DISABLE_COPY(KSaveFile) 00272 00273 class Private; 00274 Private *const d; 00275 }; 00276 00277 #endif
KDE 4.6 API Reference