diff options
author | Arno <am@disconnect.de> | 2012-02-25 19:11:59 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-02-25 19:11:59 +0100 |
commit | 26530f47ff13e20d46472c12abc7567a61c14e57 (patch) | |
tree | a582b948752ab6a47bdb39c356535e6d0ad44c27 /helper.cpp | |
parent | 67ddb23a59cb56bd917db2d9c3c7bc62c96e53b4 (diff) | |
download | SheMov-26530f47ff13e20d46472c12abc7567a61c14e57.tar.gz SheMov-26530f47ff13e20d46472c12abc7567a61c14e57.tar.bz2 SheMov-26530f47ff13e20d46472c12abc7567a61c14e57.zip |
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.
Diffstat (limited to 'helper.cpp')
-rw-r--r-- | helper.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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(); } |