diff --git a/krArc/krarc.h b/krArc/krarc.h --- a/krArc/krarc.h +++ b/krArc/krarc.h @@ -47,7 +47,6 @@ virtual void mkdir(const QUrl &url, int permissions) Q_DECL_OVERRIDE; virtual void listDir(const QUrl &url) Q_DECL_OVERRIDE; virtual void del(QUrl const & url, bool isFile) Q_DECL_OVERRIDE; - virtual void copy(const QUrl &src, const QUrl &dest, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE; public slots: void receivedData(KProcess *, QByteArray &); diff --git a/krArc/krarc.cpp b/krArc/krarc.cpp --- a/krArc/krarc.cpp +++ b/krArc/krarc.cpp @@ -678,92 +678,6 @@ } else error(KIO::ERR_DOES_NOT_EXIST, path); } -void kio_krarcProtocol::copy(const QUrl &url, const QUrl &dest, int, KIO::JobFlags flags) -{ - //qDebug() << "url:" << url << "dest:" << dest; - - if (!checkWriteSupport()) - return; - - bool overwrite = !!(flags & KIO::Overwrite); - - // KDE HACK: opening the password dlg in copy causes error for the COPY, and further problems - // that's why encrypted files are not allowed to copy - if (!encrypted && dest.isLocalFile()) - do { - if (url.fileName() != dest.fileName()) - break; - - if (QTextCodec::codecForLocale()->name() != codec->name()) - break; - - //the file exists and we don't want to overwrite - if ((!overwrite) && (QFile(getPath(dest)).exists())) { - error((int)ERR_FILE_ALREADY_EXIST, QString(QFile::encodeName(getPath(dest)))); - return; - }; - - if (!setArcFile(url)) { - error(ERR_CANNOT_ENTER_DIRECTORY, getPath(url)); - return; - } - if (newArchiveURL && !initDirDict(url)) { - error(ERR_CANNOT_ENTER_DIRECTORY, getPath(url)); - return; - } - - UDSEntry* entry = findFileEntry(url); - if (copyCmd.isEmpty() || !entry) - break; - - QString file = getPath(url).mid(getPath(arcFile->url()).length() + 1); - - QString destDir = getPath(dest, QUrl::StripTrailingSlash); - if (!QDir(destDir).exists()) { - int ndx = destDir.lastIndexOf(DIR_SEPARATOR_CHAR); - if (ndx != -1) - destDir.truncate(ndx + 1); - } - - QDir::setCurrent(destDir); - - QString escapedFilename = file; - if(arcType == "zip") // left bracket needs to be escaped - escapedFilename.replace("[", "[[]"); - - KrLinecountingProcess proc; - proc << copyCmd << getPath(arcFile->url(), QUrl::StripTrailingSlash) << escapedFilename; - if (arcType == "ace" && QFile("/dev/ptmx").exists()) // Don't remove, unace crashes if missing!!! - proc.setStandardInputFile("/dev/ptmx"); - proc.setOutputChannelMode(KProcess::SeparateChannels); // without this output redirection has no effect - - infoMessage(i18n("Unpacking %1...", url.fileName())); - proc.start(); - proc.waitForFinished(); - if (proc.exitStatus() != QProcess::NormalExit || !checkStatus(proc.exitCode())) { - error(KIO::ERR_COULD_NOT_WRITE, getPath(dest, QUrl::StripTrailingSlash) + "\n\n" + proc.getErrorMsg()); - return; - } - if (!QFileInfo(getPath(dest, QUrl::StripTrailingSlash)).exists()) { - error(KIO::ERR_COULD_NOT_WRITE, getPath(dest, QUrl::StripTrailingSlash)); - return; - } - - processedSize(KFileItem(*entry, url).size()); - finished(); - QDir::setCurrent(QDir::rootPath()); /* for being able to umount devices after copying*/ - return; - } while (0); - - if (encrypted) - qDebug() << "ERROR:" << url << "is encrypted."; - if (!dest.isLocalFile()) - qDebug() << "ERROR:" << url << "is not a local file."; - - // CMD_COPY is no more in KF5 - TODO? - //error(ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, CMD_COPY)); -} - void kio_krarcProtocol::listDir(const QUrl &url) { KRDEBUG(getPath(url));