fort/src/ui/qml/pages/BlockedPage.qml

140 lines
4.2 KiB
QML
Raw Normal View History

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
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
readonly property IpListModel ipListModel:
appBlockedModel.ipListModel(currentAppPath)
2017-09-04 11:39:15 +00:00
2017-12-25 16:01:42 +00:00
readonly property string currentAppPath: appListView.currentItemText
readonly property string currentIpText: ipListView.currentItemText
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
}
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 {
ButtonMenu {
2017-11-02 05:07:01 +00:00
enabled: appListView.count
icon.source: "qrc:/images/bin_empty.png"
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
2017-12-19 11:20:14 +00:00
&& qsTranslate("qml", "Clear…")
MenuItem {
enabled: appListView.currentIndex >= 0
text: translationManager.dummyBool
&& qsTranslate("qml", "Remove Application")
onTriggered: appBlockedModel.remove(
appListView.currentIndex)
}
MenuItem {
text: translationManager.dummyBool
&& qsTranslate("qml", "Clear All")
onTriggered: {
appListView.currentIndex = -1;
appBlockedModel.clear();
}
}
2017-09-04 11:39:15 +00:00
}
2017-11-02 05:07:01 +00:00
2017-12-25 16:01:42 +00:00
ButtonMenu {
enabled: appListView.count
icon.source: "qrc:/images/page_copy.png"
text: translationManager.dummyBool
&& qsTranslate("qml", "Copy…")
MenuItem {
enabled: !!currentAppPath
text: translationManager.dummyBool
&& qsTranslate("qml", "Application Path")
onTriggered: guiUtil.setClipboardData(currentAppPath)
}
MenuItem {
enabled: !!currentIpText
text: translationManager.dummyBool
&& qsTranslate("qml", "IP Address")
onTriggered: guiUtil.setClipboardData(currentIpText)
}
}
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;
fortManager.applyConfImmediateFlags();
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", "Show Blocked Applications")
2017-11-20 14:39:57 +00:00
checked: firewallConf.logBlocked
onToggled: {
if (firewallConf.logBlocked === checked)
return;
firewallConf.logBlocked = checked;
fortManager.applyConfImmediateFlags();
2017-11-20 14:39:57 +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-12-25 16:01:42 +00:00
IpListView {
2017-09-05 13:56:11 +00:00
id: ipListView
Layout.fillWidth: true
Layout.fillHeight: true
2017-09-05 11:06:21 +00:00
model: ipListModel
2017-09-05 11:06:21 +00:00
}
}
2017-09-02 14:36:38 +00:00
}
TextFieldFrame {
Layout.fillWidth: true
2017-11-17 10:33:14 +00:00
text: currentAppPath || ""
}
}
2017-09-02 08:07:07 +00:00
}