Workaround udisks2 mountpoint issue with Qt 6

This commit is contained in:
Jonas Kvinge 2020-12-06 18:46:30 +01:00
parent 8110035d71
commit 38cc39f23d
1 changed files with 13 additions and 5 deletions

View File

@ -370,13 +370,21 @@ Udisks2Lister::PartitionData Udisks2Lister::ReadPartitionData(const QDBusObjectP
result.uuid = block.idUUID();
result.capacity = drive.size();
if (!result.label.isEmpty())
result.friendly_name = result.label;
else
if (result.label.isEmpty()) {
result.friendly_name = result.model + " " + result.uuid;
}
else {
result.friendly_name = result.label;
}
for (const auto &p : filesystem.mountPoints())
result.mount_paths.push_back(p);
for (const QByteArray &p : filesystem.mountPoints()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // Workaround a bytearray to string conversion issue with Qt 6
QString mountpoint = QByteArray(p.data(), strlen(p.data()));
#else
QString mountpoint = p;
#endif
result.mount_paths.push_back(mountpoint);
}
result.free_space = Utilities::FileSystemFreeSpace(result.mount_paths.at(0));
}