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