X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Foperationthread.cpp;fp=src%2Foperationthread.cpp;h=873ff72b50434e4434877fd6097e6ce03036f7f9;hb=10cc2da7638bc5656e2573cd1ab84279b989fad6;hp=d0cf7e15104970a08dc49c72012bcfd4b6eea3cf;hpb=2edb4f2f10329116492492b442c2957653381c28;p=case diff --git a/src/operationthread.cpp b/src/operationthread.cpp index d0cf7e1..873ff72 100644 --- a/src/operationthread.cpp +++ b/src/operationthread.cpp @@ -302,7 +302,7 @@ void OperationThread::copy(const QFileInfo &file) { engine.seek(0); fileValue = 0; - ERROR_PROMPT(!newEngine.open(QIODevice::WriteOnly | QIODevice::Truncate), + ERROR_PROMPT(!newEngine.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Unbuffered), tr("Error writing file %1."), newPath) if (abort || response == IGNORE) { @@ -321,13 +321,9 @@ void OperationThread::copy(const QFileInfo &file) { qint64 bytes; while ((bytes = engine.read(block, sizeof(block))) > 0) { - if (bytes == -1 || bytes != newEngine.write(block, bytes)) { - if (bytes == -1) { - SHOW_ERROR_PROMPT(tr("Error while reading from file %1."), path); - } else { - SHOW_ERROR_PROMPT(tr("Error while writing to file %1."), newPath); - } - + if (bytes == -1) { + SHOW_ERROR_PROMPT(tr("Error while reading from file %1."), path); + if (!abort) { if (response == IGNORE) { updateProgress(fileSizeMap[path] - fileValue); @@ -339,10 +335,30 @@ void OperationThread::copy(const QFileInfo &file) { } error = true; break; + } else { + qint64 written = 0; + char *blockPointer = block; + while (bytes != (written = newEngine.write(blockPointer, bytes))) { + SHOW_ERROR_PROMPT(tr("Error while writing to file %1."), newPath); + + if (response == IGNORE) { + updateProgress(fileSizeMap[path] - fileValue); + removeExcludeFiles.insert(path); + ignore = true; + } + + if (abort || ignore) break; + + if (written == -1) written = 0; + bytes -= written; + blockPointer += written; + + PAUSE(); + } } PAUSE(); - if (abort) break; + if (abort || ignore) break; updateProgress(1); }