Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Firewall
Commits
8189d023
Commit
8189d023
authored
Feb 14, 2022
by
Lucas Biaggi
Committed by
Nate Graham
Feb 14, 2022
Browse files
Improve UI of simplified services interface
parent
ab859e00
Pipeline
#137453
passed with stage
in 1 minute and 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
kcm/backends/firewalld/firewalldclient.cpp
View file @
8189d023
...
...
@@ -450,15 +450,32 @@ QVector<Rule *> FirewalldClient::extractRulesFromResponse(const QStringList &rep
return
{};
}
for
(
auto
r
:
reply
)
{
// ipv4
simple_rules
.
push_back
(
new
Rule
(
Types
::
POLICY_ALLOW
,
true
,
Types
::
LOGGING_OFF
,
-
1
,
-
1
,
// TODO retrieve protocol service from firewalld
"0.0.0.0"
,
// passthrough any connection
""
,
// TODO
how to find service port?
"
0
"
,
// TODO
retrieve port service from firewalld
"0.0.0.0"
,
"0"
,
""
,
""
,
r
,
// service name
r
,
// service name
0
,
// ignore position
false
// ipv family type not relevant to firewalld zone "simple" interface
));
// ipv6
simple_rules
.
push_back
(
new
Rule
(
Types
::
POLICY_ALLOW
,
true
,
Types
::
LOGGING_OFF
,
-
1
,
// TODO retrieve protocol service from firewalld
"::"
,
// passthrough any connection
"0"
,
// TODO retrieve port service from firewalld
"::"
,
"0"
,
""
,
""
,
r
,
// service name
r
,
// service name
...
...
kcm/package/contents/ui/AdvancedRuleEdit.qml
View file @
8189d023
...
...
@@ -9,6 +9,12 @@ import org.kcm.firewall 1.0 as Firewall
Kirigami.FormLayout
{
property
var
rule
:
null
property
alias
sourceAddress
:
sourceAddress
property
alias
destinationAddress
:
destinationAddress
property
alias
destinationPort
:
destinationPort
property
alias
sourcePort
:
sourcePort
property
alias
policy
:
policy
property
alias
incoming
:
incoming
QQC2.ComboBox
{
id
:
policy
...
...
kcm/package/contents/ui/RuleEdit.qml
View file @
8189d023
...
...
@@ -49,20 +49,17 @@ FocusScope {
Kirigami.InlineMessage
{
Layout.fillWidth
:
true
type
:
Kirigami
.
MessageType
.
Information
text
:
rule
.
incoming
?
i18n
(
"
The default incoming policy is already '%1'.
"
,
policy
.
currentText
)
:
i18n
(
"
The default outgoing policy is already '%1'.
"
,
policy
.
currentText
)
visible
:
rule
.
policy
===
(
incoming
.
checked
?
defaultIncomingPolicyRule
:
defaultOutgoingPolicyRule
)
text
:
rule
.
incoming
?
i18n
(
"
The default incoming policy is already '%1'.
"
,
advancedRuleEdit
.
policy
.
currentText
)
:
i18n
(
"
The default outgoing policy is already '%1'.
"
,
advancedRuleEdit
.
policy
.
currentText
)
visible
:
rule
.
policy
===
(
advancedRuleEdit
.
incoming
.
checked
?
defaultIncomingPolicyRule
:
defaultOutgoingPolicyRule
)
&&
advancedRules
.
checked
}
QQC2.ComboBox
{
id
:
policy
Kirigami.FormData.label
:
i18n
(
"
Policy:
"
)
model
:
policyChoices
textRole
:
"
text
"
currentIndex
:
rule
.
policy
===
""
?
0
:
policyChoices
.
findIndex
((
policy
)
=>
policy
.
data
===
rule
.
policy
)
onActivated
:
rule
.
policy
=
policyChoices
[
index
].
data
Kirigami.InlineMessage
{
Layout.fillWidth
:
true
type
:
Kirigami
.
MessageType
.
Information
text
:
rule
.
incoming
?
i18n
(
"
The default incoming policy is already '%1'.
"
,
advancedRuleEdit
.
policy
.
currentText
)
:
i18n
(
"
The default outgoing policy is already '%1'.
"
,
advancedRuleEdit
.
policy
.
currentText
)
visible
:
rule
.
policy
===
(
simple
.
incoming
.
checked
?
defaultIncomingPolicyRule
:
defaultOutgoingPolicyRule
)
&&
!
advancedRules
.
checked
}
SimpleRuleEdit
{
id
:
simpleRuleEdit
visible
:
!
advancedRules
.
checked
...
...
@@ -88,9 +85,12 @@ FocusScope {
QQC2.Button
{
text
:
ruleEdit
.
newRule
?
i18n
(
"
Create
"
)
:
i18n
(
"
Save
"
)
icon.name
:
ruleEdit
.
newRule
?
"
document-new
"
:
"
document-save
"
enabled
:
(
!
sourceAddress
.
length
||
sourceAddress
.
acceptableInput
)
&&
(
!
destinationAddress
.
length
||
destinationAddress
.
acceptableInput
)
&&
!
(
sourceAddress
.
text
==
destinationAddress
.
text
&&
sourcePort
.
text
==
destinationPort
.
text
)
enabled
:
((
!
advancedRuleEdit
.
sourceAddress
.
length
||
advancedRuleEdit
.
sourceAddress
.
acceptableInput
)
&&
(
!
advancedRuleEdit
.
destinationAddress
.
length
||
advancedRuleEdit
.
destinationAddress
.
acceptableInput
)
&&
!
(
advancedRuleEdit
.
sourceAddress
.
text
==
advancedRuleEdit
.
destinationAddress
.
text
&&
advancedRuleEdit
.
sourcePort
.
text
==
advancedRuleEdit
.
destinationPort
.
text
)
||
!
(
simple
.
index
==
-
1
))
onClicked
:
{
// rule.setSourceApplication(simple.service[simple.index]);
rule
.
sourceApplication
=
simple
.
service
[
simple
.
index
]
ruleEdit
.
accepted
()
}
...
...
kcm/package/contents/ui/SimpleRuleEdit.qml
View file @
8189d023
...
...
@@ -14,22 +14,47 @@ import org.kcm.firewall 1.0 as Firewall
Kirigami.FormLayout
{
property
alias
service
:
application
.
model
property
alias
index
:
application
.
currentIndex
property
alias
policy
:
policy
property
alias
incoming
:
incoming
QQC2.ComboBox
{
id
:
application
Kirigami.FormData.label
:
kcm
.
client
.
name
==
"
firewalld
"
?
i18n
(
"
Allow connections for:
"
)
:
i18n
(
"
Application:
"
)
model
:
kcm
.
client
.
knownApplications
()
}
QQC2.ComboBox
{
id
:
policy
Kirigami.FormData.label
:
i18n
(
"
Simple Rule Edit
:
"
)
Kirigami.FormData.label
:
i18n
(
"
Policy
:
"
)
model
:
policyChoices
textRole
:
"
text
"
currentIndex
:
rule
.
policy
==
""
?
0
:
policyChoices
.
findIndex
((
policy
)
=>
policy
.
data
==
rule
.
policy
)
onActivated
:
rule
.
policy
=
policyChoices
[
index
].
data
visible
:
kcm
.
client
.
name
!=
"
firewalld
"
}
QQC2.ComboBox
{
id
:
application
Kirigami.FormData.label
:
i18n
(
"
Application:
"
)
model
:
kcm
.
client
.
knownApplications
()
RowLayout
{
Kirigami.FormData.label
:
i18n
(
"
Direction:
"
)
visible
:
kcm
.
client
.
name
!=
"
firewalld
"
QQC2.RadioButton
{
id
:
incoming
text
:
i18n
(
"
Incoming
"
)
icon.name
:
"
arrow-down
"
checked
:
rule
.
incoming
onClicked
:
rule
.
incoming
=
true
}
QQC2.RadioButton
{
text
:
i18n
(
"
Outgoing
"
)
icon.name
:
"
arrow-up
"
checked
:
!
rule
.
incoming
onClicked
:
rule
.
incoming
=
false
}
}
onVisibleChanged
:
{
console
.
log
(
"
Simple... apps... :
"
,
kcm
.
client
.
knownApplications
());
console
.
log
(
"
services available:
"
,
kcm
.
client
.
knownApplications
());
application
.
model
=
kcm
.
client
.
knownApplications
();
application
.
currentIndex
=
-
1
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment