Skip to content

Commit

Permalink
Title:fix, don't show format dialog when gio error code is G_IO_ERROR…
Browse files Browse the repository at this point in the history
…_DBUS_ERROR

Description:bug-48055的衍生问题, 在第一个挂载任务没完成前,
再发起挂载任务, 会异常弹出格式化对话框

RootCause:没有对错误类型判断,无脑弹格式化对话框

Solution: 增加错误码判断
Change-Id: I4ac0fb0d1958b13dea6c276efddcab3cc466f98f
Reviewed-on: http://gerrit.uniontech.com/c/chengdu/dde-file-manager/+/5528
Reviewed-by: zhangyu <zhangyub@uniontech.com>
Reviewed-by: <mailman@uniontech.com>
Reviewed-by: zhangsheng <zhangsheng@uniontech.com>
Reviewed-by: lvwujun <lvwujun@uniontech.com>
Reviewed-by: wangchunlin <wangchunlin@uniontech.com>
Tested-by: <mailman@uniontech.com>
  • Loading branch information
Johnson-zs committed Sep 18, 2020
1 parent e213394 commit 07e1637
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dde-file-manager-lib/gvfs/gvfsmountmanager.cpp
Expand Up @@ -1625,10 +1625,14 @@ void GvfsMountManager::mount_with_device_file_cb(GObject *object, GAsyncResult *

//! 下面这样做只是为了字符串翻译,因为错误信息是底层返回的
QString err = QString::fromLocal8Bit(error->message);
bool format = true; // 根据错误的种类, 选择是否需要格式化, 这里仅对于错误 G_IO_ERROR_DBUS_ERROR 不处理, 后续可能会扩充
switch (error->code) {
case 0:
case G_IO_ERROR_FAILED:
err = QString(tr("No key available to unlock device"));
break;
case G_IO_ERROR_DBUS_ERROR:
format = false;
break;
default:
break;
}
Expand All @@ -1637,7 +1641,9 @@ void GvfsMountManager::mount_with_device_file_cb(GObject *object, GAsyncResult *
fileSignalManager->requestShowErrorDialog(err, QString(" "));
}
} else {
dialogManager->showFormatDialog(qVolume.drive_unix_device());
if (format) {
dialogManager->showFormatDialog(qVolume.drive_unix_device());
}
}
} else {
GMount *mount;
Expand Down

0 comments on commit 07e1637

Please sign in to comment.