2017-09-02 08:07:07 +00:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
2017-12-14 08:44:10 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2017-11-02 05:50:40 +00:00
|
|
|
import "../controls"
|
2017-12-05 05:06:15 +00:00
|
|
|
import "log"
|
2017-09-02 10:17:51 +00:00
|
|
|
import com.fortfirewall 1.0
|
2017-09-02 08:07:07 +00:00
|
|
|
|
|
|
|
BasePage {
|
|
|
|
|
2017-11-17 10:33:14 +00:00
|
|
|
readonly property LogManager logManager: fortManager.logManager
|
2017-11-17 11:44:33 +00:00
|
|
|
readonly property AppBlockedModel appBlockedModel: logManager.appBlockedModel
|
2017-12-10 07:07:36 +00:00
|
|
|
readonly property IpListModel ipListModel:
|
|
|
|
appBlockedModel.ipListModel(currentAppPath)
|
2017-09-04 11:39:15 +00:00
|
|
|
|
2017-11-17 10:33:14 +00:00
|
|
|
readonly property string currentAppPath:
|
|
|
|
(appListView.currentIndex >= 0 && appListView.currentItem)
|
|
|
|
? appListView.currentItem.appPath : ""
|
2017-09-04 11:39:15 +00:00
|
|
|
|
2017-11-17 10:33:14 +00:00
|
|
|
HostInfoCache {
|
|
|
|
id: hostInfoCache
|
2017-09-04 11:39:15 +00:00
|
|
|
}
|
|
|
|
|
2017-09-02 13:48:33 +00:00
|
|
|
ColumnLayout {
|
2017-09-02 14:36:38 +00:00
|
|
|
anchors.fill: parent
|
2017-09-05 11:06:21 +00:00
|
|
|
spacing: 10
|
2017-09-02 14:36:38 +00:00
|
|
|
|
2017-09-04 11:39:15 +00:00
|
|
|
RowLayout {
|
2017-12-14 04:39:57 +00:00
|
|
|
ButtonMenu {
|
2017-11-02 05:07:01 +00:00
|
|
|
enabled: appListView.count
|
2017-12-14 04:39:57 +00:00
|
|
|
icon.source: "qrc:/images/bin_empty.png"
|
2017-09-07 10:44:15 +00:00
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Clear")
|
2017-12-14 04:39:57 +00:00
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
enabled: appListView.currentIndex >= 0
|
2017-12-14 04:53:28 +00:00
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Remove Application")
|
2017-12-14 04:39:57 +00:00
|
|
|
onTriggered: appBlockedModel.remove(
|
|
|
|
appListView.currentIndex)
|
|
|
|
}
|
|
|
|
MenuItem {
|
2017-12-14 04:53:28 +00:00
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Clear All")
|
2017-12-14 04:39:57 +00:00
|
|
|
onTriggered: {
|
|
|
|
appListView.currentIndex = -1;
|
|
|
|
appBlockedModel.clear();
|
|
|
|
}
|
|
|
|
}
|
2017-09-04 11:39:15 +00:00
|
|
|
}
|
2017-11-02 05:07:01 +00:00
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Resolve Addresses")
|
2017-11-20 14:39:57 +00:00
|
|
|
checked: firewallConf.resolveAddress
|
|
|
|
onToggled: {
|
|
|
|
if (firewallConf.resolveAddress === checked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
firewallConf.resolveAddress = checked;
|
|
|
|
|
2017-12-14 10:23:40 +00:00
|
|
|
fortManager.applyConfImmediateFlags();
|
2017-12-05 03:45:18 +00:00
|
|
|
|
|
|
|
hostInfoCache.cacheChanged(); // refresh ipListView
|
2017-11-20 14:39:57 +00:00
|
|
|
}
|
2017-11-02 05:07:01 +00:00
|
|
|
}
|
|
|
|
|
2017-09-04 11:39:15 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Switch {
|
2017-11-02 07:28:14 +00:00
|
|
|
font.weight: Font.DemiBold
|
2017-09-07 10:44:15 +00:00
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Log Blocked Applications")
|
2017-11-20 14:39:57 +00:00
|
|
|
checked: firewallConf.logBlocked
|
|
|
|
onToggled: {
|
|
|
|
if (firewallConf.logBlocked === checked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
firewallConf.logBlocked = checked;
|
|
|
|
|
2017-12-14 10:23:40 +00:00
|
|
|
fortManager.applyConfImmediateFlags();
|
2017-11-20 14:39:57 +00:00
|
|
|
}
|
2017-09-02 13:48:33 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-02 14:36:38 +00:00
|
|
|
|
2017-09-05 11:06:21 +00:00
|
|
|
Frame {
|
2017-09-02 14:36:38 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2017-09-05 11:06:21 +00:00
|
|
|
clip: true
|
|
|
|
|
2017-09-05 13:56:11 +00:00
|
|
|
RowLayout {
|
2017-09-05 11:06:21 +00:00
|
|
|
anchors.fill: parent
|
2017-09-05 13:56:11 +00:00
|
|
|
spacing: 20
|
|
|
|
|
2017-12-05 05:06:15 +00:00
|
|
|
AppListView {
|
2017-09-05 13:56:11 +00:00
|
|
|
id: appListView
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
2017-11-17 11:44:33 +00:00
|
|
|
model: appBlockedModel
|
2017-09-05 11:06:21 +00:00
|
|
|
}
|
|
|
|
|
2017-09-05 13:56:11 +00:00
|
|
|
ListView {
|
|
|
|
id: ipListView
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2017-12-12 10:43:49 +00:00
|
|
|
spacing: 5
|
2017-09-05 11:06:21 +00:00
|
|
|
|
2017-12-10 07:07:36 +00:00
|
|
|
model: ipListModel
|
2017-09-05 13:56:11 +00:00
|
|
|
|
|
|
|
delegate: Label {
|
|
|
|
width: ipListView.width
|
|
|
|
elide: Text.ElideRight
|
2017-11-20 14:39:57 +00:00
|
|
|
text: (firewallConf.resolveAddress
|
|
|
|
&& hostInfoCache.dummyBool
|
2017-11-17 10:33:14 +00:00
|
|
|
&& hostInfoCache.hostName(ipText)) || ipText
|
|
|
|
|
2017-11-17 11:58:54 +00:00
|
|
|
readonly property string ipText: display
|
2017-09-05 11:06:21 +00:00
|
|
|
}
|
2017-12-14 09:29:24 +00:00
|
|
|
|
|
|
|
ScrollBar.vertical: ScrollBarControl {}
|
2017-09-05 11:06:21 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-02 14:36:38 +00:00
|
|
|
}
|
2017-11-02 05:50:40 +00:00
|
|
|
|
|
|
|
TextFieldFrame {
|
|
|
|
Layout.fillWidth: true
|
2017-11-17 10:33:14 +00:00
|
|
|
text: currentAppPath || ""
|
2017-11-02 05:50:40 +00:00
|
|
|
}
|
2017-09-02 13:48:33 +00:00
|
|
|
}
|
2017-09-02 08:07:07 +00:00
|
|
|
}
|