}
-#define ERROR_PROMPT_XP(operation, promptString, fileName, onIgnore, quitCmd) \
+#define SPECIAL_COPY_ERROR_PROMPT(operation, promptString, fileName) \
{ \
ERROR_PROMPT(operation, promptString, fileName) \
if (abort || response == FileOperator::IGNORE) { \
- if (!abort) onIgnore; \
- quitCmd; \
+ if (!abort) { \
+ updateProgress(fileSizeMap[path]); \
+ removeExcludeFiles.insert(path); \
+ } \
+ return; \
} \
}
std::cout << "DELETING " << file.absoluteFilePath().toStdString() << std::endl;
QString path = file.absoluteFilePath();
+
+ if (removeExcludeFiles.contains(path)) {
+ if (doUpdates) updateProgress(1);
+ return false;
+ }
+
QFSFileEngine engine(path);
if (doUpdates) updateFile(path);
if (file.isDir()) {
- if (!remove(listDirFiles(path), doUpdates)) return false;
+ if (!remove(listDirFiles(path), doUpdates)) {
+ if (doUpdates) updateProgress(1);
+ return false;
+ }
if (!listDirFiles(path).size()) {
ERROR_PROMPT(!engine.rmdir(path, false), tr("Error deleting directory %1."), path)
if (response == FileOperator::KEEP) {
updateProgress(fileSizeMap[path]);
+ removeExcludeFiles.insert(path);
return;
}
}
if (!newFile.exists()) {
- ERROR_PROMPT_XP(!engine.mkdir(newPath, false),
- tr("Error creating directory %1."), newPath,
- updateProgress(fileSizeMap[path]),
- return)
+ SPECIAL_COPY_ERROR_PROMPT(!engine.mkdir(newPath, false),
+ tr("Error creating directory %1."), newPath)
}
updateProgress(1);
dest = destBackup;
} else {
- ERROR_PROMPT_XP(engine.isSequential(),
- tr("Cannot copy sequential file %1."), path,
- updateProgress(fileSizeMap[path]),
- return)
+ SPECIAL_COPY_ERROR_PROMPT(engine.isSequential(), tr("Cannot copy sequential file %1."), path)
if (newFile.exists() && newFile.isDir()) {
- ERROR_PROMPT_XP(!remove(newPath),
- tr("Cannot replace directory %1 due to previous errors."), newPath,
- updateProgress(fileSizeMap[path]),
- return)
+ SPECIAL_COPY_ERROR_PROMPT(!remove(newPath),
+ tr("Cannot replace directory %1 due to previous errors."), newPath)
}
- ERROR_PROMPT_XP(!engine.open(QIODevice::ReadOnly),
- tr("Error reading file %1."), path,
- updateProgress(fileSizeMap[path]),
- return)
+ SPECIAL_COPY_ERROR_PROMPT(!engine.open(QIODevice::ReadOnly), tr("Error reading file %1."), path)
bool ignore = false;
while (!abort && !ignore) {
engine.seek(0);
+ fileValue = 0;
ERROR_PROMPT(!newEngine.open(QIODevice::WriteOnly | QIODevice::Truncate),
tr("Error writing file %1."), newPath)
if (abort || response == FileOperator::IGNORE) {
if (response == FileOperator::IGNORE) {
- updateProgress(fileSizeMap[path] - fileValue);
+ updateProgress(fileSizeMap[path]);
+ removeExcludeFiles.insert(path);
ignore = true;
}
break;
if (!abort) {
if (response == FileOperator::IGNORE) {
updateProgress(fileSizeMap[path] - fileValue);
+ removeExcludeFiles.insert(path);
ignore = true;
} else {
updateProgress(-fileValue);
OVERWRITE_PROMPT(files[i], QFileInfo(newPath))
if (response == FileOperator::KEEP) {
- // TODO lets not remove the source for now, I'm not sure what is correct behavior
- // remove(path);
if (abort) break;
updateProgress(1);
continue;