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
8ad946c5
Commit
8ad946c5
authored
Dec 09, 2020
by
Lucas Biaggi
Browse files
removing cpp files
parent
d662fae3
Changes
2
Hide whitespace changes
Inline
Side-by-side
kcm/core/rulewrapper.cpp
deleted
100644 → 0
View file @
d662fae3
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2011 Craig Drummond <craig.p.drummond@gmail.com>
// SPDX-FileCopyrightText: 2018 Alexis Lopes Zubeta <contact@azubieta.net>
// SPDX-FileCopyrightText: 2020 Tomaz Canabrava <tcanabrava@kde.org>
/*
* UFW KControl Module
*/
#include
"rulewrapper.h"
#include
"firewallclient.h"
#include
"types.h"
RuleWrapper
::
RuleWrapper
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_interface
(
0
)
{
m_rule
.
setProtocol
(
0
);
}
RuleWrapper
::
RuleWrapper
(
Rule
rule
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_rule
(
rule
)
{
int
iface_index
=
FirewallClient
::
knownInterfaces
().
indexOf
(
m_rule
.
interfaceIn
());
m_interface
=
iface_index
==
-
1
?
0
:
iface_index
;
m_rule
.
setProtocol
(
0
);
}
QString
RuleWrapper
::
policy
()
const
{
auto
policy
=
m_rule
.
action
();
return
Types
::
toString
(
policy
);
}
bool
RuleWrapper
::
incoming
()
const
{
return
m_rule
.
incoming
();
}
QString
RuleWrapper
::
sourceAddress
()
const
{
return
m_rule
.
sourceAddress
();
}
QString
RuleWrapper
::
sourcePort
()
const
{
return
m_rule
.
sourcePort
();
}
QString
RuleWrapper
::
destinationAddress
()
const
{
return
m_rule
.
destAddress
();
}
QString
RuleWrapper
::
destinationPort
()
const
{
return
m_rule
.
destPort
();
}
bool
RuleWrapper
::
ipv6
()
const
{
return
m_rule
.
ipv6
();
}
int
RuleWrapper
::
protocol
()
const
{
return
m_rule
.
protocol
();
}
int
RuleWrapper
::
interface
()
const
{
return
m_interface
;
}
QString
RuleWrapper
::
logging
()
const
{
auto
logging
=
m_rule
.
logging
();
return
Types
::
toString
(
logging
);
}
Rule
RuleWrapper
::
rule
()
{
return
m_rule
;
}
int
RuleWrapper
::
position
()
const
{
return
m_rule
.
position
();
}
void
RuleWrapper
::
setPolicy
(
const
QString
&
policy
)
{
auto
policy_t
=
Types
::
toPolicy
(
policy
);
if
(
policy_t
==
m_rule
.
action
())
{
return
;
}
m_rule
.
setAction
(
policy_t
);
emit
policyChanged
(
policy
);
}
void
RuleWrapper
::
setIncoming
(
bool
incoming
)
{
if
(
m_rule
.
incoming
()
==
incoming
)
{
return
;
}
m_rule
.
setIncoming
(
incoming
);
emit
incomingChanged
(
incoming
);
}
void
RuleWrapper
::
setSourceAddress
(
const
QString
&
sourceAddress
)
{
if
(
m_rule
.
sourceAddress
()
==
sourceAddress
)
{
return
;
}
m_rule
.
setSourceAddress
(
sourceAddress
);
emit
sourceAddressChanged
(
sourceAddress
);
}
void
RuleWrapper
::
setSourcePort
(
const
QString
&
sourcePort
)
{
if
(
m_rule
.
sourcePort
()
==
sourcePort
)
{
return
;
}
m_rule
.
setSourcePort
(
sourcePort
);
emit
sourcePortChanged
(
sourcePort
);
}
void
RuleWrapper
::
setDestinationAddress
(
const
QString
&
destinationAddress
)
{
if
(
m_rule
.
destAddress
()
==
destinationAddress
)
{
return
;
}
m_rule
.
setDestAddress
(
destinationAddress
);
emit
destinationAddressChanged
(
destinationAddress
);
}
void
RuleWrapper
::
setDestinationPort
(
const
QString
&
destinationPort
)
{
if
(
m_rule
.
destPort
()
==
destinationPort
)
{
return
;
}
m_rule
.
setDestPort
(
destinationPort
);
emit
destinationPortChanged
(
destinationPort
);
}
void
RuleWrapper
::
setIpv6
(
bool
ipv6
)
{
if
(
m_rule
.
ipv6
()
==
ipv6
)
{
return
;
}
m_rule
.
setV6
(
ipv6
);
emit
ipv6Changed
(
ipv6
);
}
void
RuleWrapper
::
setProtocol
(
int
protocol
)
{
if
(
m_rule
.
protocol
()
==
protocol
)
{
return
;
}
m_rule
.
setProtocol
(
protocol
);
emit
protocolChanged
(
protocol
);
}
void
RuleWrapper
::
setInterface
(
int
interface
)
{
if
(
m_interface
==
interface
)
{
return
;
}
m_rule
.
setInterfaceIn
(
interface
!=
0
?
FirewallClient
::
knownInterfaces
().
at
(
interface
)
:
QString
());
m_interface
=
interface
;
emit
interfaceChanged
(
interface
);
}
void
RuleWrapper
::
setLogging
(
const
QString
&
logging
)
{
auto
logging_t
=
Types
::
toLogging
(
logging
);
if
(
m_rule
.
logging
()
==
logging_t
)
{
return
;
}
m_rule
.
setLogging
(
logging_t
);
emit
loggingChanged
(
logging
);
}
void
RuleWrapper
::
setPosition
(
int
position
)
{
if
(
m_rule
.
position
()
==
position
)
{
return
;
}
m_rule
.
setPosition
(
position
);
emit
positionChanged
(
position
);
}
kcm/core/rulewrapper.h
deleted
100644 → 0
View file @
d662fae3
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2011 Craig Drummond <craig.p.drummond@gmail.com>
// SPDX-FileCopyrightText: 2018 Alexis Lopes Zubeta <contact@azubieta.net>
// SPDX-FileCopyrightText: 2020 Tomaz Canabrava <tcanabrava@kde.org>
/*
* UFW KControl Module
*/
#pragma once
#include
<kcm_firewall_core_export.h>
#include
<QObject>
#include
"rule.h"
#include
"types.h"
class
KCM_FIREWALL_CORE_EXPORT
RuleWrapper
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QString
policy
READ
policy
WRITE
setPolicy
NOTIFY
policyChanged
)
Q_PROPERTY
(
bool
incoming
READ
incoming
WRITE
setIncoming
NOTIFY
incomingChanged
)
Q_PROPERTY
(
QString
sourceAddress
READ
sourceAddress
WRITE
setSourceAddress
NOTIFY
sourceAddressChanged
)
Q_PROPERTY
(
QString
sourcePort
READ
sourcePort
WRITE
setSourcePort
NOTIFY
sourcePortChanged
)
Q_PROPERTY
(
QString
destinationAddress
READ
destinationAddress
WRITE
setDestinationAddress
NOTIFY
destinationAddressChanged
)
Q_PROPERTY
(
QString
destinationPort
READ
destinationPort
WRITE
setDestinationPort
NOTIFY
destinationPortChanged
)
Q_PROPERTY
(
bool
ipv6
READ
ipv6
WRITE
setIpv6
NOTIFY
ipv6Changed
)
Q_PROPERTY
(
int
protocol
READ
protocol
WRITE
setProtocol
NOTIFY
protocolChanged
)
Q_PROPERTY
(
int
interface
READ
interface
WRITE
setInterface
NOTIFY
interfaceChanged
)
Q_PROPERTY
(
QString
logging
READ
logging
WRITE
setLogging
NOTIFY
loggingChanged
)
Q_PROPERTY
(
int
position
READ
position
WRITE
setPosition
NOTIFY
positionChanged
)
public:
explicit
RuleWrapper
(
QObject
*
parent
=
nullptr
);
explicit
RuleWrapper
(
Rule
rule
,
QObject
*
parent
=
nullptr
);
QString
policy
()
const
;
bool
incoming
()
const
;
QString
sourceAddress
()
const
;
QString
sourcePort
()
const
;
QString
destinationAddress
()
const
;
QString
destinationPort
()
const
;
bool
ipv6
()
const
;
int
protocol
()
const
;
int
interface
()
const
;
QString
logging
()
const
;
Rule
rule
();
int
position
()
const
;
signals:
void
policyChanged
(
const
QString
&
policy
);
void
directionChanged
(
const
QString
&
direction
);
void
sourceAddressChanged
(
const
QString
&
sourceAddress
);
void
sourcePortChanged
(
const
QString
&
sourcePort
);
void
destinationAddressChanged
(
const
QString
&
destinationAddress
);
void
destinationPortChanged
(
const
QString
&
destinationPort
);
void
ipv6Changed
(
bool
ipv6
);
void
protocolChanged
(
int
protocol
);
void
interfaceChanged
(
int
interface
);
void
loggingChanged
(
const
QString
&
logging
);
void
incomingChanged
(
bool
incoming
);
void
positionChanged
(
int
position
);
public
slots
:
void
setPolicy
(
const
QString
&
policy
);
void
setIncoming
(
bool
incoming
);
void
setSourceAddress
(
const
QString
&
sourceAddress
);
void
setSourcePort
(
const
QString
&
sourcePort
);
void
setDestinationAddress
(
const
QString
&
destinationAddress
);
void
setDestinationPort
(
const
QString
&
destinationPort
);
void
setIpv6
(
bool
ipv6
);
void
setProtocol
(
int
protocol
);
void
setInterface
(
int
interface
);
void
setLogging
(
const
QString
&
logging
);
void
setPosition
(
int
position
);
private:
Rule
m_rule
;
int
m_interface
;
};
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