mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kioslave: do not emit canResume() signal for put jobs from curl slave
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c6d390bb5f
commit
04fcbb5f05
2 changed files with 30 additions and 20 deletions
|
@ -524,8 +524,22 @@ void CurlProtocol::get(const KUrl &url)
|
|||
return;
|
||||
}
|
||||
|
||||
CURLcode curlresult = CURLE_OK;
|
||||
if (hasMetaData(QLatin1String("resume"))) {
|
||||
Q_ASSERT(sizeof(qlonglong) == sizeof(curl_off_t));
|
||||
const qlonglong resumeoffset = metaData(QLatin1String("resume")).toLongLong();
|
||||
kDebug(7103) << "Resume offset" << resumeoffset;
|
||||
curlresult = curl_easy_setopt(m_curl, CURLOPT_RESUME_FROM_LARGE, curl_off_t(resumeoffset));
|
||||
if (curlresult != CURLE_OK) {
|
||||
KIO_CURL_ERROR(curlresult);
|
||||
return;
|
||||
} else {
|
||||
canResume();
|
||||
}
|
||||
}
|
||||
|
||||
KUrl redirecturl;
|
||||
CURLcode curlresult = performCurl(url, &redirecturl);
|
||||
curlresult = performCurl(url, &redirecturl);
|
||||
kDebug(7103) << "Get result" << curlresult;
|
||||
if (curlresult != CURLE_OK) {
|
||||
const KIO::Error kioerror = curlToKIOError(curlresult, m_curl);
|
||||
|
@ -544,10 +558,8 @@ void CurlProtocol::get(const KUrl &url)
|
|||
|
||||
void CurlProtocol::put(const KUrl &url, int permissions, KIO::JobFlags flags)
|
||||
{
|
||||
// TODO: job flags for ftp/sftp only, check if URL exists on server
|
||||
// NOTE: CURLOPT_NEW_FILE_PERMS is documented to work only for some protocols, ftp is not one
|
||||
// of them but sftp is
|
||||
Q_UNUSED(flags);
|
||||
|
||||
kDebug(7103) << "Put URL" << url.prettyUrl() << permissions << flags;
|
||||
|
||||
|
@ -569,6 +581,16 @@ void CurlProtocol::put(const KUrl &url, int permissions, KIO::JobFlags flags)
|
|||
return;
|
||||
}
|
||||
|
||||
if (flags & KIO::Resume) {
|
||||
// it is optional anyway
|
||||
kWarning(7103) << "Resuming not supported";
|
||||
}
|
||||
|
||||
if (!(flags & KIO::Overwrite)) {
|
||||
kWarning(7103) << "Not overwriting not supported";
|
||||
// TODO: check if destination exists, emit ERR_DIR_ALREADY_EXIST or ERR_FILE_ALREADY_EXIST
|
||||
}
|
||||
|
||||
const QString putfilename = url.path();
|
||||
const QByteArray putpermissions = ftpPermissions(permissions);
|
||||
kDebug(7103) << "Filename" << putfilename << "permissions" << putpermissions;
|
||||
|
@ -808,11 +830,11 @@ void CurlProtocol::slotData(const char* curldata, const size_t curldatasize)
|
|||
}
|
||||
}
|
||||
|
||||
void CurlProtocol::slotProgress(const KIO::filesize_t received, const KIO::filesize_t total)
|
||||
void CurlProtocol::slotProgress(const KIO::filesize_t progress, const KIO::filesize_t total)
|
||||
{
|
||||
kDebug(7103) << "Received" << received << "from" << total;
|
||||
processedSize(received);
|
||||
if (total > 0 && received != total) {
|
||||
kDebug(7103) << "Progress is" << progress << "from" << total;
|
||||
processedSize(progress);
|
||||
if (total > 0 && progress != total) {
|
||||
totalSize(total);
|
||||
}
|
||||
}
|
||||
|
@ -988,18 +1010,6 @@ bool CurlProtocol::setupCurl(const KUrl &url, const bool ftporsftp)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (hasMetaData(QLatin1String("resume"))) {
|
||||
Q_ASSERT(sizeof(qlonglong) == sizeof(curl_off_t));
|
||||
const qlonglong resumeoffset = metaData(QLatin1String("resume")).toLongLong();
|
||||
curlresult = curl_easy_setopt(m_curl, CURLOPT_RESUME_FROM_LARGE, curl_off_t(resumeoffset));
|
||||
if (curlresult != CURLE_OK) {
|
||||
KIO_CURL_ERROR(curlresult);
|
||||
return false;
|
||||
} else {
|
||||
canResume();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_curlheaders) {
|
||||
curl_slist_free_all(m_curlheaders);
|
||||
m_curlheaders = nullptr;
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void del(const KUrl &url, bool isfile) final;
|
||||
|
||||
void slotData(const char* curldata, const size_t curldatasize);
|
||||
void slotProgress(const KIO::filesize_t received, const KIO::filesize_t total);
|
||||
void slotProgress(const KIO::filesize_t progress, const KIO::filesize_t total);
|
||||
|
||||
bool aborttransfer;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue