From 9e015a502805adc17ea3ee4458d838b37752f77b Mon Sep 17 00:00:00 2001 From: xust Date: Wed, 20 Sep 2023 16:25:04 +0800 Subject: [PATCH] fix: [disc] some hint issue. Log: fix issue that error info is not correct. Bug: https://pms.uniontech.com/bug-view-220713.html --- .../controller/computercontroller.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/plugins/filemanager/core/dfmplugin-computer/controller/computercontroller.cpp b/src/plugins/filemanager/core/dfmplugin-computer/controller/computercontroller.cpp index 070feb9ca7..e5a3b1aff9 100644 --- a/src/plugins/filemanager/core/dfmplugin-computer/controller/computercontroller.cpp +++ b/src/plugins/filemanager/core/dfmplugin-computer/controller/computercontroller.cpp @@ -312,26 +312,26 @@ void ComputerController::mountDevice(quint64 winId, const QString &id, const QSt ComputerUtils::setCursorState(true); DevMngIns->mountBlockDevAsync(id, {}, [=](bool ok, const DFMMOUNT::OperationErrorInfo &err, const QString &mpt) { - bool isOpticalDevice = id.contains(QRegularExpression("/sr[0-9]*$")); - if (ok || isOpticalDevice) { - QUrl u = isOpticalDevice ? ComputerUtils::makeBurnUrl(id) : ComputerUtils::makeLocalUrl(mpt); - - if (isOpticalDevice) - this->waitUDisks2DataReady(id); - - ComputerItemWatcherInstance->insertUrlMapper(id, u); - if (!shellId.isEmpty()) - ComputerItemWatcherInstance->insertUrlMapper(shellId, QUrl::fromLocalFile(mpt)); - - cdTo(id, u, winId, act); - } else { + if (!ok) { if (err.code == DFMMOUNT::DeviceError::kUDisksErrorNotAuthorizedDismissed) { ComputerUtils::setCursorState(); return; } qInfo() << "mount device failed: " << id << err.message << err.code; DialogManagerInstance->showErrorDialogWhenOperateDeviceFailed(DFMBASE_NAMESPACE::DialogManager::kMount, err); + return; } + + bool isOpticalDevice = id.contains(QRegularExpression("/sr[0-9]*$")); + if (isOpticalDevice) + this->waitUDisks2DataReady(id); + + QUrl u = isOpticalDevice ? ComputerUtils::makeBurnUrl(id) : ComputerUtils::makeLocalUrl(mpt); + ComputerItemWatcherInstance->insertUrlMapper(id, u); + if (!shellId.isEmpty()) + ComputerItemWatcherInstance->insertUrlMapper(shellId, QUrl::fromLocalFile(mpt)); + + cdTo(id, u, winId, act); ComputerUtils::setCursorState(); }); }