From 26530f47ff13e20d46472c12abc7567a61c14e57 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 25 Feb 2012 19:11:59 +0100 Subject: Make NewPicsDialog archive pictures Finally NewPicsDialog actually does something. Added another parameter to Helper::moveToArchive. If set to true, files will only be copied instead of moved. Default is false, not changing the expected behavior. --- helper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index 80a8bc2..30d5fff 100644 --- a/helper.cpp +++ b/helper.cpp @@ -88,7 +88,7 @@ namespace Helper { return retval; } - const QString moveToArchive(const QString &path, const QString &md5){ + const QString moveToArchive(const QString &path, const QString &md5, bool copy){ QFileInfo info(path); if(!info.exists()){ return QString(); @@ -104,7 +104,12 @@ namespace Helper { if(!destDir.exists()){ QDir::root().mkpath(destFile.absolutePath()); } - bool success = QFile::rename(path, destFile.absoluteFilePath()); + bool success = false; + if(copy){ + success = QFile::copy(path, destFile.absoluteFilePath()); + }else{ + success = QFile::rename(path, destFile.absoluteFilePath()); + } if(success){ return destFile.absoluteFilePath(); } -- cgit v1.2.3-70-g09d2