Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a7c0490c authored by Yuri Chornoivan's avatar Yuri Chornoivan

Port away from deprecated KIO::NetAccess

Summary: Port away from KIO::NetAccess leftovers

Test Plan: Compiles and installs, works at least with usual downloads.

Reviewers: #kde_applications, wbauer

Reviewed By: wbauer

Differential Revision: https://phabricator.kde.org/D18985
parent 5aa206f9
......@@ -22,7 +22,6 @@
#include <QDebug>
#include <KLocalizedString>
#include <kio/copyjob.h>
#include <kio/netaccess.h>
//static QString REGULAR_EXPRESSION = "(((https?|ftp|gopher)://|(mailto|file|news):)[^’ <>\"]+|(www|web|w3).[-a-z0-9.]+)[^’ .,;<>\":]";
// static QString REGULAR_EXPRESSION = "((http|https|ftp|ftps)+([\\:\\w\\d:#@%/;$()~_?\\+-=\\\\.&])*)";
......@@ -80,9 +79,7 @@ void LinkImporter::copyRemoteFile()
QUrl aux(m_tempFile);
KIO::CopyJob *job = KIO::copy(m_url, aux, KIO::HideProgressInfo);
QMap<QString, QString> metaData;
bool ok = KIO::NetAccess::synchronousRun(job, nullptr, nullptr, nullptr, &metaData);
if(!ok) {
if(!job->exec()) {
emit error(ki18n("Error trying to get %1").subs(m_url.url()));
}
}
......
......@@ -22,8 +22,8 @@
#include "plugin/transferfactory.h"
#include "kget_debug.h"
#include <qdebug.h>
#include <KIO/NetAccess>
#include <QDebug>
#include <KIO/StatJob>
QUrl mostLocalUrl(const QUrl &url)
{
......@@ -35,8 +35,12 @@ QUrl mostLocalUrl(const QUrl &url)
}
}
qCDebug(KGET_DEBUG) << "Starting KIO::NetAccess::mostLocalUrl for:" << url;
return KIO::NetAccess::mostLocalUrl(url, nullptr);
qCDebug(KGET_DEBUG) << "Trying to find the most local URL for:" << url;
KIO::StatJob* job = KIO::mostLocalUrl(url, KIO::HideProgressInfo);
if (job->exec()) {
return job->mostLocalUrl();
};
return url;
}
MostLocalUrlJob *mostLocalUrlJob(const QUrl &url)
......
......@@ -15,7 +15,6 @@
#include <QRegExp>
#include <QIcon>
#include <kio/netaccess.h>
#include <QDebug>
#include "jobqueue.h"
......
......@@ -25,7 +25,6 @@
#include <QFile>
#include <KIO/DeleteJob>
#include <KIO/NetAccess>
#include <QStandardPaths>
......@@ -63,7 +62,9 @@ void ChecksumSearchController::registerSearch(ChecksumSearchTransferDataSource *
const QUrl dest = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QStringLiteral("/checksumsearch/") + QString::number(files++));
if (QFile::exists(dest.toLocalFile())) {
KIO::Job *del = KIO::del(dest, KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << dest.path();
}
}
if (baseUrl.scheme() != "ftp" && baseUrl.scheme() != "sftp") {
......
......@@ -23,7 +23,6 @@
#include <kio/scheduler.h>
#include <KIO/DeleteJob>
#include <KIO/CopyJob>
#include <KIO/NetAccess>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -125,7 +124,9 @@ void TransferKio::deinit(Transfer::DeleteOptions options)
if (options & DeleteFiles)//if the transfer is not finished, we delete the *.part-file
{
KIO::Job *del = KIO::del(QString(m_dest.path() + ".part"), KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete part " << QString(m_dest.path() + ".part");
}
}//TODO: Ask the user if he/she wants to delete the *.part-file? To discuss (boom1992)
}
......
......@@ -25,7 +25,6 @@
#include "kget_debug.h"
#include <KIconLoader>
#include <KIO/DeleteJob>
#include <KIO/NetAccess>
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
......
......@@ -25,7 +25,6 @@
#include <KIconLoader>
#include <KIO/DeleteJob>
#include <KIO/NetAccess>
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -290,7 +289,9 @@ void Metalink::deinit(Transfer::DeleteOptions options)
if ((options & Transfer::DeleteTemporaryFiles) && m_localMetalinkLocation.isLocalFile())
{
KIO::Job *del = KIO::del(m_localMetalinkLocation, KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << m_localMetalinkLocation.path();
}
}
}
......
......@@ -28,7 +28,6 @@
#include <KIconLoader>
#include <KIO/DeleteJob>
#include <KIO/NetAccess>
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
......
......@@ -28,7 +28,6 @@
#include <KIconLoader>
#include <KIO/DeleteJob>
#include <KIO/NetAccess>
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -259,7 +258,9 @@ void MetalinkXml::deinit(Transfer::DeleteOptions options)
if ((options & Transfer::DeleteTemporaryFiles) && m_localMetalinkLocation.isLocalFile())
{
KIO::Job *del = KIO::del(m_localMetalinkLocation, KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << m_localMetalinkLocation.path();
}
}
}
......
......@@ -103,9 +103,13 @@ void MmsTransfer::deinit(Transfer::DeleteOptions options)
/** Deleting the temporary file and the unfinish file*/
if (options & Transfer::DeleteFiles) {
KIO::Job *del = KIO::del(QUrl::fromLocalFile(m_fileTemp), KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << m_fileTemp;
}
del = KIO::del(m_dest, KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << m_dest.path();
}
}
}
......@@ -126,7 +130,9 @@ void MmsTransfer::slotResult()
m_downloadSpeed = 0;
setTransferChange(Tc_Status | Tc_Percent | Tc_DownloadSpeed, true);
KIO::Job *del = KIO::del(QUrl::fromLocalFile(m_fileTemp), KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << m_fileTemp;
}
}
/** If m_retryDownload == true then some threads has fail to connect, so the download was
......@@ -137,7 +143,9 @@ void MmsTransfer::slotResult()
if (m_retryDownload) {
m_retryDownload = false;
KIO::Job *del = KIO::del(QUrl::fromLocalFile(m_fileTemp), KIO::HideProgressInfo);
KIO::NetAccess::synchronousRun(del, nullptr);
if (!del->exec()) {
qCDebug(KGET_DEBUG) << "Could not delete " << m_fileTemp;
}
start();
}
}
......
......@@ -25,7 +25,6 @@
#include <KIconLoader>
#include <KIO/CopyJob>
#include <KIO/NetAccess>
#include <KLocalizedString>
#include <KMessageBox>
......
......@@ -24,7 +24,6 @@
#include <QDate>
#include <QDebug>
#include <kio/netaccess.h>
#include <kio/global.h>
#include <kio/pixmaploader.h>
#include <KIconLoader>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment