KBackup
Functions | |
bool | backupFile (const QString &qFilename, const QString &backupDir) |
KCOREADDONS_EXPORT | KCOREADDONS_DEPRECATED_VERSION_BELATED (5, 75, 5, 0, "Use simpleBackupFile() or numberedBackupFile() directly") bool backupFile(const QString &filename |
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("~")) |
Variables | |
KCOREADDONS_EXPORT const QString & | backupDir = QString()) |
Detailed Description
Provides utility functions for backup of files.
Function Documentation
◆ KCOREADDONS_DEPRECATED_VERSION_BELATED()
KCOREADDONS_EXPORT KBackup::KCOREADDONS_DEPRECATED_VERSION_BELATED | ( | 5 | , |
75 | , | ||
5 | , | ||
0 | , | ||
"Use simpleBackupFile() or numberedBackupFile() directly" | |||
) | const & |
Function to create a backup file before saving.
- Warning
- This code lost its former functionality during the conversion from KDELibs4 to KDE Framrworks 5. It now only forwards and calls To restore the former functionality for your software, which read the backup type (simple or numbered), extension string, and maximum number of backup files from the user's global configuration, you could use code like this:KBackup::simpleBackupFile(filename, backupDir, QStringLiteral("~")));bool success = false;const int maxNumber = configGroup.readEntry("MaxBackups", 10);success = numberedBackupFile(filename, backupDir, extension, maxNumber);} else {success = simpleBackupFile(filename, backupDir, extension);}
- Parameters
-
filename the file to backup backupDir optional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename
.
- Returns
- true if successful, or false if an error has occurred.
- Deprecated:
- Since 5.0, use simpleBackupFile() or numberedBackupFile() directly
◆ 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
-
filename the file to backup backupDir optional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename
.backupExtension the extension to append to filename
, which is "~" by default. Do not use an extension containing digits.maxBackups the 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 120 of file kbackup.cpp.
◆ rcsBackupFile()
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
-
filename the file to backup backupDir optional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename
.backupMessage is the RCS commit message for this revision.
- Returns
- true if successful, or false if an error has occurred.
- Deprecated:
- Since 5.75, no known users
Definition at line 47 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
-
filename the file to backup backupDir optional directory where to save the backup file in. If empty (the default), the backup will be in the same directory as filename
.backupExtension the extension to append to filename
, "~" by default.
- Returns
- true if successful, or false if an error has occurred.
Definition at line 32 of file kbackup.cpp.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:11:30 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.