Commit 767be3af authored by Raine Makelainen's avatar Raine Makelainen

[systemsettings] Expose isEncrypted role from partition model. Contributes to JB#42529

parent a7f1c589
......@@ -86,6 +86,11 @@ bool Partition::mountFailed() const
return d && d->mountFailed;
}
bool Partition::isEncrypted() const
{
return d && d->isEncrypted;
}
bool Partition::isCryptoDevice() const
{
return d ? d->isCryptoDevice : false;
......
......@@ -104,6 +104,7 @@ public:
bool canMount() const;
bool mountFailed() const;
bool isCryptoDevice() const;
bool isEncrypted() const;
StorageType storageType() const;
......
......@@ -48,6 +48,7 @@ public:
, status(Partition::Unmounted)
, readOnly(true)
, canMount(false)
, isEncrypted(false)
, isCryptoDevice(false)
, isSupportedFileSystemType(false)
, mountFailed(false)
......@@ -76,6 +77,7 @@ public:
Partition::Status status;
bool readOnly;
bool canMount;
bool isEncrypted;
bool isCryptoDevice;
bool isSupportedFileSystemType;
bool mountFailed;
......
......@@ -252,6 +252,7 @@ QHash<int, QByteArray> PartitionModel::roleNames() const
{ PartitionModelRole, "partitionModel" },
{ IsCryptoDeviceRoles, "isCryptoDevice"},
{ IsSupportedFileSystemType, "isSupportedFileSystemType"},
{ IsEncryptedRoles, "isEncrypted"},
};
return roleNames;
......@@ -302,6 +303,8 @@ QVariant PartitionModel::data(const QModelIndex &index, int role) const
return partition.isCryptoDevice();
case IsSupportedFileSystemType:
return partition.isSupportedFileSystemType();
case IsEncryptedRoles:
return partition.isEncrypted();
default:
return QVariant();
}
......
......@@ -64,6 +64,7 @@ public:
PartitionModelRole,
IsCryptoDeviceRoles,
IsSupportedFileSystemType,
IsEncryptedRoles,
};
// For Status role
......
......@@ -294,6 +294,7 @@ void UDisks2::Monitor::setPartitionProperties(QExplicitlySharedDataPointer<Parti
partition->status = blockDevice->isEncrypted() ? Partition::Locked
: blockDevice->mountPath().isEmpty() ? Partition::Unmounted : Partition::Mounted;
partition->isCryptoDevice = blockDevice->isEncrypted() || blockDevice->hasCryptoBackingDevice();
partition->isEncrypted = blockDevice->isEncrypted();
}
void UDisks2::Monitor::updatePartitionProperties(const UDisks2::Block *blockDevice)
......
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