mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-24 02:00:24 +07:00
Add role for allowed for installation containers
This commit is contained in:
@@ -37,6 +37,7 @@ QVariant ContainersModel::data(const QModelIndex &index, int role) const
|
||||
case EasySetupHeaderRole: return ContainerProps::easySetupHeader(container);
|
||||
case EasySetupDescriptionRole: return ContainerProps::easySetupDescription(container);
|
||||
case EasySetupOrderRole: return ContainerProps::easySetupOrder(container);
|
||||
case IsInstallationAllowedRole: return ContainersModel::isInstallationAllowed(container);
|
||||
case IsInstalledRole: return m_containers.contains(container);
|
||||
case IsCurrentlyProcessedRole: return container == static_cast<DockerContainer>(m_processedContainerIndex);
|
||||
case IsSupportedRole: return ContainerProps::isSupportedByCurrentPlatform(container);
|
||||
@@ -114,6 +115,11 @@ bool ContainersModel::hasInstalledProtocols()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ContainersModel::isInstallationAllowed(DockerContainer container)
|
||||
{
|
||||
return container != DockerContainer::AwgLegacy;
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ContainersModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles;
|
||||
@@ -133,7 +139,7 @@ QHash<int, QByteArray> ContainersModel::roleNames() const
|
||||
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
|
||||
roles[IsSupportedRole] = "isSupported";
|
||||
roles[IsShareableRole] = "isShareable";
|
||||
|
||||
roles[IsInstallationAllowedRole] = "isInstallationAllowed";
|
||||
roles[InstallPageOrderRole] = "installPageOrder";
|
||||
return roles;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
EasySetupDescriptionRole,
|
||||
EasySetupOrderRole,
|
||||
|
||||
IsInstallationAllowedRole,
|
||||
IsInstalledRole,
|
||||
IsCurrentlyProcessedRole,
|
||||
IsDefaultRole,
|
||||
@@ -57,6 +58,8 @@ public slots:
|
||||
bool hasInstalledServices();
|
||||
bool hasInstalledProtocols();
|
||||
|
||||
static bool isInstallationAllowed(DockerContainer container);
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
|
||||
@@ -31,14 +31,19 @@ Item {
|
||||
value: true
|
||||
}
|
||||
|
||||
ExpressionFilter {
|
||||
id: awgLegacyFilter
|
||||
// 2 - DockerContainer.AwgLegacy
|
||||
expression: model.dockerContainer !== 2 || model.isInstalled
|
||||
ValueFilter {
|
||||
id: installationAllowedFilter
|
||||
roleName: "isInstallationAllowed"
|
||||
value: true
|
||||
}
|
||||
|
||||
AnyOf {
|
||||
id: showProtocolFilter
|
||||
filters: [ installedFilter, installationAllowedFilter ]
|
||||
}
|
||||
|
||||
function getWriteAccessProtocolsListFilters() {
|
||||
return [vpnTypeFilter, awgLegacyFilter]
|
||||
return [ vpnTypeFilter, showProtocolFilter ]
|
||||
}
|
||||
function getReadAccessProtocolsListFilters() {
|
||||
return [vpnTypeFilter, installedFilter]
|
||||
|
||||
Reference in New Issue
Block a user