Commit 49440c0c authored by Méven Car's avatar Méven Car
Browse files

Replace usage of deprecated SlaveBase::config() by SlaveBase::configValue

Summary:
With D23523 and D24582, we can avoid some IO by not using SlaveBase::config()

Will wait for KF 5.64 release before landing.

Test Plan: Compiles

Reviewers: dfaure

Reviewed By: dfaure

Subscribers: elvisangelaccio, kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D24686
parent 3148c395
......@@ -10,7 +10,7 @@ project(kio-extras VERSION ${KDE_APPLICATIONS_VERSION})
include(FeatureSummary)
set(QT_MIN_VERSION "5.8.0")
set(KF5_MIN_VERSION "5.48.0")
set(KF5_MIN_VERSION "5.64.0")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS DBus Network Widgets Svg)
find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
......
......@@ -862,7 +862,7 @@ void NFSProtocolV2::copySame(const QUrl& src, const QUrl& dest, int _mode, KIO::
const QString partFilePath = destPath + QLatin1String(".part");
const NFSFileHandle partFH = getFileHandle(partFilePath);
const bool bPartExists = !partFH.isInvalid();
const bool bMarkPartial = m_slave->config()->readEntry("MarkPartial", true);
const bool bMarkPartial = m_slave->configValue(QStringLiteral("MarkPartial"), true);
if (bPartExists) {
int rpcStatus;
......@@ -992,7 +992,7 @@ void NFSProtocolV2::copySame(const QUrl& src, const QUrl& dest, int _mode, KIO::
if (error) {
if (bMarkPartial) {
// Remove the part file if it's smaller than the minimum keep size.
const unsigned int size = m_slave->config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const unsigned int size = m_slave->configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (writeArgs.offset < size) {
if (!remove(partFilePath)) {
qCDebug(LOG_KIO_NFS) << "Could not remove part file, ignoring...";
......@@ -1077,7 +1077,7 @@ void NFSProtocolV2::copyFrom(const QUrl& src, const QUrl& dest, int _mode, KIO::
bool bResume = false;
const QFileInfo partInfo(destPath + QLatin1String(".part"));
const bool bPartExists = partInfo.exists();
const bool bMarkPartial = m_slave->config()->readEntry("MarkPartial", true);
const bool bMarkPartial = m_slave->configValue(QStringLiteral("MarkPartial"), true);
if (bMarkPartial && bPartExists && partInfo.size() > 0) {
if (partInfo.isDir()) {
......@@ -1195,7 +1195,7 @@ void NFSProtocolV2::copyFrom(const QUrl& src, const QUrl& dest, int _mode, KIO::
if (error) {
if (bMarkPartial) {
// Remove the part file if it's smaller than the minimum keep
const int size = m_slave->config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const int size = m_slave->configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (partInfo.size() < size) {
QFile::remove(partInfo.absoluteFilePath());
}
......@@ -1277,7 +1277,7 @@ void NFSProtocolV2::copyTo(const QUrl& src, const QUrl& dest, int _mode, KIO::Jo
const QString partFilePath = destPath + QLatin1String(".part");
const NFSFileHandle partFH = getFileHandle(partFilePath);
const bool bPartExists = !partFH.isInvalid();
const bool bMarkPartial = m_slave->config()->readEntry("MarkPartial", true);
const bool bMarkPartial = m_slave->configValue(QStringLiteral("MarkPartial"), true);
if (bPartExists) {
int rpcStatus;
......@@ -1392,7 +1392,7 @@ void NFSProtocolV2::copyTo(const QUrl& src, const QUrl& dest, int _mode, KIO::Jo
if (error) {
if (bMarkPartial) {
// Remove the part file if it's smaller than the minimum keep size.
const unsigned int size = m_slave->config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const unsigned int size = m_slave->configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (writeArgs.offset < size) {
if (!remove(partFilePath)) {
qCDebug(LOG_KIO_NFS) << "Could not remove part file, ignoring...";
......
......@@ -1107,7 +1107,7 @@ void NFSProtocolV3::copySame(const QUrl& src, const QUrl& dest, int _mode, KIO::
const QString partFilePath = destPath + QLatin1String(".part");
const NFSFileHandle partFH = getFileHandle(partFilePath);
const bool bPartExists = !partFH.isInvalid();
const bool bMarkPartial = m_slave->config()->readEntry("MarkPartial", true);
const bool bMarkPartial = m_slave->configValue(QStringLiteral("MarkPartial"), true);
if (bPartExists) {
int rpcStatus;
......@@ -1241,7 +1241,7 @@ void NFSProtocolV3::copySame(const QUrl& src, const QUrl& dest, int _mode, KIO::
if (error) {
if (bMarkPartial) {
// Remove the part file if it's smaller than the minimum keep size.
const unsigned int size = m_slave->config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const unsigned int size = m_slave->configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (writeArgs.offset < size) {
if (!remove(partFilePath)) {
qCDebug(LOG_KIO_NFS) << "Could not remove part file, ignoring...";
......@@ -1333,7 +1333,7 @@ void NFSProtocolV3::copyFrom(const QUrl& src, const QUrl& dest, int _mode, KIO::
bool bResume = false;
const QFileInfo partInfo(destPath + QLatin1String(".part"));
const bool bPartExists = partInfo.exists();
const bool bMarkPartial = m_slave->config()->readEntry("MarkPartial", true);
const bool bMarkPartial = m_slave->configValue(QStringLiteral("MarkPartial"), true);
if (bMarkPartial && bPartExists && partInfo.size() > 0) {
if (partInfo.isDir()) {
......@@ -1451,7 +1451,7 @@ void NFSProtocolV3::copyFrom(const QUrl& src, const QUrl& dest, int _mode, KIO::
if (error) {
if (bMarkPartial) {
// Remove the part file if it's smaller than the minimum keep
const int size = m_slave->config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const int size = m_slave->configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (partInfo.size() < size) {
QFile::remove(partInfo.absoluteFilePath());
}
......@@ -1531,7 +1531,7 @@ void NFSProtocolV3::copyTo(const QUrl& src, const QUrl& dest, int _mode, KIO::Jo
const QString partFilePath = destPath + QLatin1String(".part");
const NFSFileHandle partFH = getFileHandle(partFilePath);
const bool bPartExists = !partFH.isInvalid();
const bool bMarkPartial = m_slave->config()->readEntry("MarkPartial", true);
const bool bMarkPartial = m_slave->configValue(QStringLiteral("MarkPartial"), true);
if (bPartExists) {
int rpcStatus;
......@@ -1653,7 +1653,7 @@ void NFSProtocolV3::copyTo(const QUrl& src, const QUrl& dest, int _mode, KIO::Jo
if (error) {
if (bMarkPartial) {
// Remove the part file if it's smaller than the minimum keep size.
const unsigned int size = m_slave->config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const unsigned int size = m_slave->configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (writeArgs.offset < size) {
if (!remove(partFilePath)) {
qCDebug(LOG_KIO_NFS) << "Could not remove part file, ignoring...";
......
......@@ -1658,7 +1658,7 @@ sftpProtocol::StatusCode sftpProtocol::sftpPut(const QUrl& url, int permissions,
sftp_attributes sb = sftp_lstat(mSftp, dest_orig_c.constData());
const bool bOrigExists = (sb != nullptr);
bool bPartExists = false;
const bool bMarkPartial = config()->readEntry("MarkPartial", true);
const bool bMarkPartial = configValue(QStringLiteral("MarkPartial"), true);
// Don't change permissions of the original file
if (bOrigExists) {
......@@ -1808,7 +1808,7 @@ sftpProtocol::StatusCode sftpProtocol::sftpPut(const QUrl& url, int permissions,
sftp_attributes attr = sftp_stat(mSftp, dest.constData());
if (bMarkPartial && attr != nullptr) {
size_t size = config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
size_t size = configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (attr->size < size) {
sftp_unlink(mSftp, dest.constData());
}
......@@ -1952,7 +1952,7 @@ sftpProtocol::StatusCode sftpProtocol::sftpCopyGet(const QUrl& url, const QStrin
const QString sPart = sCopyFile + QLatin1String(".part"); // do we have a ".part" file?
QFileInfo partFile(sPart);
const bool bPartExists = partFile.exists();
const bool bMarkPartial = config()->readEntry("MarkPartial", true);
const bool bMarkPartial = configValue(QStringLiteral("MarkPartial"), true);
const QString dest = (bMarkPartial ? sPart : sCopyFile);
if (bMarkPartial && bPartExists && copyFile.size() > 0) {
......@@ -2022,7 +2022,7 @@ sftpProtocol::StatusCode sftpProtocol::sftpCopyGet(const QUrl& url, const QStrin
}
else{
partFile.refresh();
const int size = config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const int size = configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (partFile.exists() && partFile.size() < size) { // should a very small ".part" be deleted?
QFile::remove(sPart);
}
......
......@@ -251,7 +251,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
bool bResume = false;
const QFileInfo partInfo (dstFile + QLatin1String(".part"));
const bool bPartExists = partInfo.exists();
const bool bMarkPartial = config()->readEntry("MarkPartial", true);
const bool bMarkPartial = configValue(QStringLiteral("MarkPartial"), true);
if (bMarkPartial && bPartExists && partInfo.size() > 0) {
if (partInfo.isDir()) {
......@@ -389,7 +389,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
if (isErr) {
const QString sPart = partInfo.absoluteFilePath();
if (bMarkPartial) {
const int size = config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const int size = configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
if (partInfo.size() < size) {
QFile::remove(sPart);
}
......@@ -462,7 +462,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
bool bResume = false;
bool bPartExists = false;
const bool bMarkPartial = config()->readEntry("MarkPartial", true);
const bool bMarkPartial = configValue(QStringLiteral("MarkPartial"), true);
const SMBUrl dstOrigUrl (kdst);
if (bMarkPartial) {
......@@ -576,7 +576,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
// Handle error condition.
if (isErr) {
if (bMarkPartial) {
const int size = config()->readEntry("MinimumKeepSize", DEFAULT_MINIMUM_KEEP_SIZE);
const int size = configValue(QStringLiteral("MinimumKeepSize"), DEFAULT_MINIMUM_KEEP_SIZE);
const int errNum = cache_stat(dstUrl, &st);
if (errNum == 0 && st.st_size < size) {
smbc_unlink(dstUrl.toSmbcUrl());
......
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