From b255574746be6236f51a79cbd657da0477399ec4 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 20 Jul 2019 18:46:33 +0200 Subject: [PATCH] Port kdeconnect's kioslave to UDSEntry::fastInsert. This requires KF 5.48, released in July 2018. --- CMakeLists.txt | 2 +- kio/kiokdeconnect.cpp | 46 +++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 735dfeb42..f44e79b52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(KDECONNECT_VERSION_PATCH 4) set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}") set(QT_MIN_VERSION "5.7.0") -set(KF5_MIN_VERSION "5.42.0") +set(KF5_MIN_VERSION "5.48.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) diff --git a/kio/kiokdeconnect.cpp b/kio/kiokdeconnect.cpp index d09c5505b..43d2867e3 100644 --- a/kio/kiokdeconnect.cpp +++ b/kio/kiokdeconnect.cpp @@ -107,21 +107,21 @@ void KioKdeconnect::listAllDevices() const QString icon = QStringLiteral("kdeconnect"); KIO::UDSEntry entry; - entry.insert(KIO::UDSEntry::UDS_NAME, name); - entry.insert(KIO::UDSEntry::UDS_ICON_NAME, icon); - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); - entry.insert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); - entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String("")); - entry.insert(KIO::UDSEntry::UDS_URL, path); + entry.fastInsert(KIO::UDSEntry::UDS_NAME, name); + entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, icon); + entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); + entry.fastInsert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String("")); + entry.fastInsert(KIO::UDSEntry::UDS_URL, path); listEntry(entry); } // We also need a non-null and writable UDSentry for "." KIO::UDSEntry entry; - entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral(".")); - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); - entry.insert(KIO::UDSEntry::UDS_SIZE, 0); - entry.insert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH); + entry.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral(".")); + entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); + entry.fastInsert(KIO::UDSEntry::UDS_SIZE, 0); + entry.fastInsert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH); listEntry(entry); infoMessage(QLatin1String("")); @@ -192,22 +192,22 @@ void KioKdeconnect::listDevice(const QString& device) const QString icon = QStringLiteral("folder"); KIO::UDSEntry entry; - entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral("files")); - entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); - entry.insert(KIO::UDSEntry::UDS_ICON_NAME, icon); - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); - entry.insert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); - entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String("")); - entry.insert(KIO::UDSEntry::UDS_URL, QUrl::fromLocalFile(path).toString()); + entry.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral("files")); + entry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); + entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, icon); + entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); + entry.fastInsert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String("")); + entry.fastInsert(KIO::UDSEntry::UDS_URL, QUrl::fromLocalFile(path).toString()); listEntry(entry); } // We also need a non-null and writable UDSentry for "." KIO::UDSEntry entry; - entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral(".")); - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); - entry.insert(KIO::UDSEntry::UDS_SIZE, 0); - entry.insert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH); + entry.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral(".")); + entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); + entry.fastInsert(KIO::UDSEntry::UDS_SIZE, 0); + entry.fastInsert(KIO::UDSEntry::UDS_ACCESS, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH); listEntry(entry); infoMessage(QLatin1String("")); @@ -241,14 +241,14 @@ void KioKdeconnect::stat(const QUrl& url) qCDebug(KDECONNECT_KIO) << "Stat: " << url; KIO::UDSEntry entry; - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); + entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); QString currentDevice = url.host(); if (!currentDevice.isEmpty()) { SftpDbusInterface interface(currentDevice); if (interface.isValid()) { - entry.insert(KIO::UDSEntry::UDS_LOCAL_PATH, interface.mountPoint()); + entry.fastInsert(KIO::UDSEntry::UDS_LOCAL_PATH, interface.mountPoint()); if (!interface.isMounted()) { interface.mount();