From 1889b9e8fa5f2a27f493c733ce640c41917c92d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Fri, 8 Sep 2017 17:58:27 +0100 Subject: [PATCH] Port unmount code away from KMountPoints (KIO). --- src/core/partition.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/partition.cpp b/src/core/partition.cpp index 678d3b2..02838c3 100644 --- a/src/core/partition.cpp +++ b/src/core/partition.cpp @@ -29,12 +29,12 @@ #include "util/report.h" #include +#include #include #include #include #include -#include /** Creates a new Partition object. @param parent the Partition's parent. May be another Partition (for logicals) or a PartitionTable. Must not be nullptr. @@ -326,17 +326,18 @@ bool Partition::unmount(Report& report) if (!isMounted()) return false; - bool success = true; + bool success = false; - while (success) { - if (fileSystem().canUnmount(deviceNode())) { - success = fileSystem().unmount(report, deviceNode()); - } + if (fileSystem().canUnmount(deviceNode())) { + success = fileSystem().unmount(report, deviceNode()); + } - KMountPoint::List mountPoints = KMountPoint::currentMountPoints(KMountPoint::NeedRealDeviceName); - - if (!mountPoints.findByDevice(deviceNode())) + const QList mountedVolumes = QStorageInfo::mountedVolumes(); + for (const QStorageInfo &storage : QStorageInfo::mountedVolumes()) { + if (QString::fromUtf8(storage.device()) == deviceNode() ) { + success = false; break; + } } setMounted(!success);