hotfix bug#133362 【文件管理器】【PTOF】空光驱识别提示信息与预期不符

This commit is contained in:
yangling 2022-08-15 16:30:02 +08:00 committed by Yue-Lan
parent 8c0cc0299b
commit 6b714b3907
3 changed files with 20 additions and 1 deletions

View File

@ -211,7 +211,9 @@ void SideBarFileSystemItem::initVolumeInfo(const Experimental_Peony::Volume &vol
m_uri = "computer:///" + volumeItem.name() + ".volume";/* 手机(mtp、gphoto2) */
m_mounted = true;
}
else if(m_device.contains("/dev/sr") && FileUtils::isEmptyDisc(m_device))//更好的方法区分是否是空光盘?
else if(m_device.contains("/dev/sr") &&
(FileUtils::isEmptyDisc(m_device) /* 空光盘linkto bug#127947 */
|| Experimental_Peony::VolumeManager::getInstance()->isEmptyDrive(volumeItem)))/* 空光驱,linkto bug#133362 */
{
m_mounted=true;
m_unmountable = m_mountable=false;

View File

@ -99,6 +99,15 @@ QString VolumeManager::getTargetUriFromUnixDevice(const QString &unixDevice){
return Peony::FileUtils::urlDecode(uri);
}
bool VolumeManager::isEmptyDrive(const Volume &volume)
{
g_autoptr (GDrive) gdrive = volume.getGDrive();
if (gdrive && !g_drive_has_media(gdrive)) {/* 空光驱 */
return true;
}
return false;
}
VolumeManager::VolumeManager(QObject *parent) : QObject(parent)
{
initManagerInfo();
@ -1424,6 +1433,11 @@ GVolume* Volume::getGVolume() const{
return m_volume;
}
GDrive *Volume::getGDrive() const
{
return m_gdrive;
}
bool Volume::canEject() const{
return m_canEject;
}

View File

@ -38,6 +38,8 @@ public:
return m_occupiedAppsInfoThread;
}
bool isEmptyDrive(const Volume &volume);/* 判断是否为空光驱 */
private:
explicit VolumeManager(QObject *parent = nullptr);
bool gpartedIsOpening();
@ -159,6 +161,7 @@ public:
QString originalDevice() const;
QString mountPoint() const;
GVolume* getGVolume() const;
GDrive* getGDrive() const;
//property-to-set
void setLabel(const QString& label);
void setDevice(const QString &device);