Changeset View
Changeset View
Standalone View
Standalone View
krArc/krarc.cpp
Context not available. | |||||
333 | fd = QT_OPEN(ba, O_CREAT | O_TRUNC | O_WRONLY, initialMode); | 333 | fd = QT_OPEN(ba, O_CREAT | O_TRUNC | O_WRONLY, initialMode); | ||
---|---|---|---|---|---|
334 | } | 334 | } | ||
335 | QByteArray buffer; | 335 | QByteArray buffer; | ||
336 | int readResult; | 336 | if (realPut) { | ||
337 | do { | 337 | int readResult; | ||
338 | dataReq(); | 338 | do { | ||
339 | readResult = readData(buffer); | 339 | dataReq(); | ||
340 | readResult = readData(buffer); | ||||
341 | ::write(fd, buffer.data(), buffer.size()); | ||||
342 | } while (readResult > 0); | ||||
343 | } else { | ||||
344 | QFile file(putFile.path()); | ||||
345 | if (!file.open(QIODevice::ReadOnly)) | ||||
346 | return; | ||||
347 | buffer = file.readAll(); | ||||
340 | ::write(fd, buffer.data(), buffer.size()); | 348 | ::write(fd, buffer.data(), buffer.size()); | ||
341 | } while (readResult > 0); | 349 | } | ||
342 | ::close(fd); | 350 | ::close(fd); | ||
343 | // pack the file | 351 | // pack the file | ||
344 | KrLinecountingProcess proc; | 352 | KrLinecountingProcess proc; | ||
Context not available. | |||||
688 | if (url.fileName() != dest.fileName()) | 696 | if (url.fileName() != dest.fileName()) | ||
689 | break; | 697 | break; | ||
690 | 698 | | |||
691 | if (QTextCodec::codecForLocale()->name() != codec->name()) | 699 | if (QTextCodec::codecForLocale()->name() != codec->name() && realCopy) | ||
692 | break; | 700 | break; | ||
693 | 701 | | |||
694 | //the file exists and we don't want to overwrite | 702 | //the file exists and we don't want to overwrite | ||
Context not available. | |||||
760 | error(ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, 74)); | 768 | error(ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, 74)); | ||
761 | } | 769 | } | ||
762 | 770 | | |||
771 | void kio_krarcProtocol::rename(const QUrl& src, const QUrl& dest, KIO::JobFlags flags) | ||||
772 | { | ||||
773 | KRDEBUG("renaming from: " << src.path() << " to: " << dest.path()); | ||||
774 | | ||||
775 | if (!checkWriteSupport()) | ||||
776 | return; | ||||
777 | | ||||
778 | QUrl tmp = QUrl(arcTempDir + src.fileName()); | ||||
779 | tmp.setScheme("file"); | ||||
780 | | ||||
781 | realCopy = false; | ||||
782 | copy(src, tmp, 0, flags); | ||||
783 | realCopy = true; | ||||
784 | | ||||
785 | QFile::rename(tmp.path(), arcTempDir + dest.fileName()); | ||||
786 | tmp.setPath(arcTempDir + dest.fileName()); | ||||
787 | KRDEBUG(tmp.path()); | ||||
788 | | ||||
789 | realPut = false; | ||||
790 | putFile = tmp; | ||||
791 | put(dest, -1, flags); | ||||
792 | realPut = true; | ||||
793 | putFile = QUrl(); | ||||
794 | | ||||
795 | finished(); | ||||
796 | } | ||||
797 | | ||||
798 | | ||||
763 | void kio_krarcProtocol::listDir(const QUrl &url) | 799 | void kio_krarcProtocol::listDir(const QUrl &url) | ||
764 | { | 800 | { | ||
765 | KRFUNC; | 801 | KRFUNC; | ||
Context not available. |