Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [computer] avoid updating device size #1978

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/dfm-base/base/device/private/devicewatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void DeviceWatcherPrivate::queryUsageOfItem(const QVariantMap &itemData, dfmmoun
? queryUsageOfBlock(itemData)
: queryUsageOfProtocol(itemData);

if (old != newStorage && newStorage.isValid()) {
if (/*old != newStorage && */ newStorage.isValid()) {
const QString &devId = itemData.value(DeviceProperty::kId).toString();
emit DevMngIns->devSizeChanged(devId,
itemData.value(DeviceProperty::kSizeTotal).toULongLong(),
Expand All @@ -120,7 +120,8 @@ DevStorage DeviceWatcherPrivate::queryUsageOfBlock(const QVariantMap &itemData)
QStorageInfo si(itemData.value(DeviceProperty::kMountPoint).toString());
quint64 total = itemData.value(DeviceProperty::kSizeTotal).toULongLong();
qint64 avai = si.bytesAvailable();
if (avai < 0) avai = 0;
if (avai < 0) // if nagative value returned, error occured.
return {};
return { total, static_cast<quint64>(avai), total - avai };
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/dfm-base/utils/dialogmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ void DialogManager::showErrorDialogWhenOperateDeviceFailed(OperateType type, DFM
errMsg = tr("Permission denied");
else if (static_cast<int>(err.code) == ENOENT)
errMsg = tr("No such file or directory");
else if (err.code >= DeviceError::kGIOError
&& err.code <= DeviceError::kGIOErrorMessageTooLarge)
errMsg = err.message;
else
errMsg = tr("Error occured while mounting device");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DAEMONPMOUNTCONTROL_USE_NAMESPACE
static constexpr char kPolicyKitActionId[] { "com.deepin.filemanager.daemon.MountController" };

CifsMountHelper::CifsMountHelper(QDBusContext *context)
: AbstractMountHelper(context), d(new CifsMountHelperPrivate()) { }
: AbstractMountHelper(context), d(new CifsMountHelperPrivate()) {}

QVariantMap CifsMountHelper::mount(const QString &path, const QVariantMap &opts)
{
Expand Down Expand Up @@ -311,7 +311,7 @@ std::string CifsMountHelper::convertArgs(const QVariantMap &opts)
if (opts.contains(kTimeout)) {
param += QString("echo_interval=1,");
if (opts.contains(kTryWaitReconn))
param += QString("wait_reconnect_timeout=%1,").arg(/*opts.value(kTimeout).toString()*/ 0); // w_r_t = ?? s
param += QString("wait_reconnect_timeout=%1,").arg(/*opts.value(kTimeout).toString()*/ 1); // w_r_t = ?? s
else
param += QString("handletimeout=%1,").arg(opts.value(kTimeout).toInt() * 1000); // handletimeout = ?? ms
}
Expand Down
Loading