Port kdeconnect's kioslave to UDSEntry::fastInsert.

This requires KF 5.48, released in July 2018.
This commit is contained in:
David Faure 2019-07-20 18:46:33 +02:00
parent 8f1660d580
commit b255574746
2 changed files with 24 additions and 24 deletions

View file

@ -8,7 +8,7 @@ set(KDECONNECT_VERSION_PATCH 4)
set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}") set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}")
set(QT_MIN_VERSION "5.7.0") 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) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)

View file

@ -107,21 +107,21 @@ void KioKdeconnect::listAllDevices()
const QString icon = QStringLiteral("kdeconnect"); const QString icon = QStringLiteral("kdeconnect");
KIO::UDSEntry entry; KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, name); entry.fastInsert(KIO::UDSEntry::UDS_NAME, name);
entry.insert(KIO::UDSEntry::UDS_ICON_NAME, icon); entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, icon);
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); entry.fastInsert(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.fastInsert(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.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String(""));
entry.insert(KIO::UDSEntry::UDS_URL, path); entry.fastInsert(KIO::UDSEntry::UDS_URL, path);
listEntry(entry); listEntry(entry);
} }
// We also need a non-null and writable UDSentry for "." // We also need a non-null and writable UDSentry for "."
KIO::UDSEntry entry; KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral(".")); entry.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral("."));
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
entry.insert(KIO::UDSEntry::UDS_SIZE, 0); entry.fastInsert(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_ACCESS, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH);
listEntry(entry); listEntry(entry);
infoMessage(QLatin1String("")); infoMessage(QLatin1String(""));
@ -192,22 +192,22 @@ void KioKdeconnect::listDevice(const QString& device)
const QString icon = QStringLiteral("folder"); const QString icon = QStringLiteral("folder");
KIO::UDSEntry entry; KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral("files")); entry.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral("files"));
entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); entry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, name);
entry.insert(KIO::UDSEntry::UDS_ICON_NAME, icon); entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, icon);
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); entry.fastInsert(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.fastInsert(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.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String(""));
entry.insert(KIO::UDSEntry::UDS_URL, QUrl::fromLocalFile(path).toString()); entry.fastInsert(KIO::UDSEntry::UDS_URL, QUrl::fromLocalFile(path).toString());
listEntry(entry); listEntry(entry);
} }
// We also need a non-null and writable UDSentry for "." // We also need a non-null and writable UDSentry for "."
KIO::UDSEntry entry; KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral(".")); entry.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral("."));
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
entry.insert(KIO::UDSEntry::UDS_SIZE, 0); entry.fastInsert(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_ACCESS, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH);
listEntry(entry); listEntry(entry);
infoMessage(QLatin1String("")); infoMessage(QLatin1String(""));
@ -241,14 +241,14 @@ void KioKdeconnect::stat(const QUrl& url)
qCDebug(KDECONNECT_KIO) << "Stat: " << url; qCDebug(KDECONNECT_KIO) << "Stat: " << url;
KIO::UDSEntry entry; 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(); QString currentDevice = url.host();
if (!currentDevice.isEmpty()) { if (!currentDevice.isEmpty()) {
SftpDbusInterface interface(currentDevice); SftpDbusInterface interface(currentDevice);
if (interface.isValid()) { if (interface.isValid()) {
entry.insert(KIO::UDSEntry::UDS_LOCAL_PATH, interface.mountPoint()); entry.fastInsert(KIO::UDSEntry::UDS_LOCAL_PATH, interface.mountPoint());
if (!interface.isMounted()) { if (!interface.isMounted()) {
interface.mount(); interface.mount();