diff --git a/src/plugins/libparted/CMakeLists.txt b/src/plugins/libparted/CMakeLists.txt index f1d2a8c..0995554 100644 --- a/src/plugins/libparted/CMakeLists.txt +++ b/src/plugins/libparted/CMakeLists.txt @@ -34,7 +34,7 @@ set (pmlibpartedbackendplugin_SRCS add_library(pmlibpartedbackendplugin SHARED ${pmlibpartedbackendplugin_SRCS}) -target_link_libraries(pmlibpartedbackendplugin kpmcore ${LIBPARTED_LIBS} KF5::KIOCore KF5::I18n) +target_link_libraries(pmlibpartedbackendplugin kpmcore ${LIBPARTED_LIBS} KF5::I18n) install(TARGETS pmlibpartedbackendplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}) kcoreaddons_desktop_to_json(pmlibpartedbackendplugin pmlibpartedbackendplugin.desktop DEFAULT_SERVICE_TYPE) diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index 11e37d3..ba8e914 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -49,11 +49,11 @@ #include #include #include +#include #include #include #include -#include #include #include @@ -198,11 +198,9 @@ static qint64 readSectorsUsedLibParted(PedDisk* pedDisk, const Partition& p) static void readSectorsUsed(PedDisk* pedDisk, const Device& d, Partition& p, const QString& mountPoint) { if (!mountPoint.isEmpty() && p.fileSystem().type() != FileSystem::LinuxSwap && p.fileSystem().type() != FileSystem::Lvm2_PV) { - const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint); - - // KDiskFreeSpaceInfo does not work with swap - if (p.isMounted() && freeSpaceInfo.isValid()) - p.fileSystem().setSectorsUsed(freeSpaceInfo.used() / d.logicalSize()); + const QStorageInfo storage = QStorageInfo(mountPoint); + if (p.isMounted() && storage.isValid()) + p.fileSystem().setSectorsUsed( (storage.bytesTotal() - storage.bytesFree()) / d.logicalSize()); } else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportFileSystem) p.fileSystem().setSectorsUsed(p.fileSystem().readUsedCapacity(p.deviceNode()) / d.logicalSize());