Commit 8cd3a87e authored by Raine Makelainen's avatar Raine Makelainen

[systemsettings] Expose isSupportedFileSystem role from partition model. Contributes to JB#42526

parent daedc486
......@@ -121,6 +121,12 @@ QString Partition::filesystemType() const
return d ? d->filesystemType : QString();
}
bool Partition::isSupportedFileSystemType() const
{
return d ? d->isSupportedFileSystemType : false;
}
qint64 Partition::bytesAvailable() const
{
return d ? d->bytesAvailable : 0;
......
......@@ -113,6 +113,7 @@ public:
QString mountPath() const;
QString filesystemType() const;
bool isSupportedFileSystemType() const;
qint64 bytesAvailable() const;
qint64 bytesTotal() const;
......
......@@ -49,6 +49,7 @@ public:
, readOnly(true)
, canMount(false)
, isCryptoDevice(false)
, isSupportedFileSystemType(false)
, mountFailed(false)
, deviceRoot(false)
, valid(false)
......@@ -76,6 +77,7 @@ public:
bool readOnly;
bool canMount;
bool isCryptoDevice;
bool isSupportedFileSystemType;
bool mountFailed;
bool deviceRoot;
// If valid, only mount status and available bytes will be checked
......
......@@ -244,6 +244,7 @@ void PartitionManagerPrivate::refresh(const Partitions &partitions, Partitions &
partition->deviceName = deviceName;
partition->deviceRoot = deviceRoot.match(deviceName).hasMatch();
partition->filesystemType = QString::fromUtf8(mountEntry.mnt_type);
partition->isSupportedFileSystemType = supportedFileSystems().contains(partition->filesystemType);
partition->status = partition->activeState == QStringLiteral("deactivating")
? Partition::Unmounting
: Partition::Mounted;
......
......@@ -269,6 +269,7 @@ QHash<int, QByteArray> PartitionModel::roleNames() const
{ BytesFreeRole, "bytesFree" },
{ PartitionModelRole, "partitionModel" },
{ IsCryptoDeviceRoles, "isCryptoDevice"},
{ IsSupportedFileSystemType, "isSupportedFileSystemType"},
};
return roleNames;
......@@ -317,6 +318,8 @@ QVariant PartitionModel::data(const QModelIndex &index, int role) const
return QVariant::fromValue(static_cast<QObject*>(const_cast<PartitionModel*>((this))));
case IsCryptoDeviceRoles:
return partition.isCryptoDevice();
case IsSupportedFileSystemType:
return partition.isSupportedFileSystemType();
default:
return QVariant();
}
......
......@@ -63,6 +63,7 @@ public:
BytesFreeRole,
PartitionModelRole,
IsCryptoDeviceRoles,
IsSupportedFileSystemType,
};
// For Status role
......
......@@ -287,6 +287,7 @@ void UDisks2::Monitor::setPartitionProperties(QExplicitlySharedDataPointer<Parti
partition->mountPath = blockDevice->mountPath();
partition->deviceLabel = label;
partition->filesystemType = blockDevice->idType();
partition->isSupportedFileSystemType = m_manager->supportedFileSystems().contains(partition->filesystemType);
partition->readOnly = blockDevice->isReadOnly();
partition->canMount = blockDevice->isMountable() && m_manager->supportedFileSystems().contains(partition->filesystemType);
partition->status = blockDevice->isEncrypted() ? Partition::Locked
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment