KBackup

KBackup Namespace Reference

Functions

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

Detailed Description

Provides utility functions for backup of files.

Function Documentation

◆ numberedBackupFile()

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 34 of file kbackup.cpp.

◆ simpleBackupFile()

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 20 of file kbackup.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.