KBackup

KBackup Namespace Reference

Functions

bool backupFile (const QString &filename, const QString &backupDir=QString())
 
bool numberedBackupFile (const QString &filename, const QString &backupDir=QString(), const QString &backupExtension=QStringLiteral("~"), const uint maxBackups=10)
 
bool rcsBackupFile (const QString &filename, const QString &backupDir=QString(), const QString &backupMessage=QString())
 
bool simpleBackupFile (const QString &filename, const QString &backupDir=QString(), const QString &backupExtension=QStringLiteral("~"))
 

Detailed Description

Provides utility functions for backup of files.

Function Documentation

KCOREADDONS_EXPORT bool KBackup::backupFile ( const QString filename,
const QString backupDir = QString() 
)

Function to create a backup file before saving.

If empty (the default), the backup will be in the same directory as filename. The backup type (simple, rcs, or numbered), extension string, and maximum number of backup files are read from the user's global configuration. Use simpleBackupFile() or numberedBackupFile() to force one of these specific backup styles. You can use this method even if you don't use KSaveFile.

Parameters
filenamethe file to backup
backupDiroptional directory where to save the backup file in.
Returns
true if successful, or false if an error has occurred.

Definition at line 24 of file kbackup.cpp.

KCOREADDONS_EXPORT bool KBackup::numberedBackupFile ( const QString filename,
const QString backupDir = QString(),
const QString backupExtension = QStringLiteral("~"),
const uint  maxBackups = 10 
)

Function to create a backup file for a given filename.

This function creates a series of numbered backup files from the given filename.

The backup file names will be of the form: <name>.<number><extension> for instance

chat.3.log 

The new backup file will be have the backup number 1. Each existing backup file will have its number incremented by 1. Any backup files with numbers greater than the maximum number permitted (maxBackups) will be removed. You can use this method even if you don't use KSaveFile.

Parameters
filenamethe file to backup
backupDiroptional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename.
backupExtensionthe extension to append to filename, which is "~" by default. Do not use an extension containing digits.
maxBackupsthe maximum number of backup files permitted. For best performance a small number (10) is recommended.
Returns
true if successful, or false if an error has occurred.

Definition at line 137 of file kbackup.cpp.

KCOREADDONS_EXPORT bool KBackup::rcsBackupFile ( const QString filename,
const QString backupDir = QString(),
const QString backupMessage = QString() 
)

Function to create an rcs backup file for a given filename.

This function creates a rcs-formatted backup file from the given filename.

The backup file names will be of the form: <name>,v for instance

photo.jpg,v 

The new backup file will be in RCS format. Each existing backup file will be committed as a new revision. You can use this method even if you don't use KSaveFile.

Parameters
filenamethe file to backup
backupDiroptional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename.
backupMessageis the RCS commit message for this revision.
Returns
true if successful, or false if an error has occurred.

Definition at line 63 of file kbackup.cpp.

KCOREADDONS_EXPORT bool KBackup::simpleBackupFile ( const QString filename,
const QString backupDir = QString(),
const QString backupExtension = QStringLiteral("~") 
)

Function to create a backup file for a given filename.

This function creates a backup file from the given filename. You can use this method even if you don't use KSaveFile.

Parameters
filenamethe file to backup
backupDiroptional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename.
backupExtensionthe extension to append to filename, "~" by default.
Returns
true if successful, or false if an error has occurred.

Definition at line 47 of file kbackup.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 30 2020 23:10:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.