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

133 lines
3.9 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-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
}
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
&& 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
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", "Log 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-09-05 13:56:11 +00:00
ListView {
id: ipListView
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 5
2017-09-05 11:06:21 +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
}
TextFieldFrame {
Layout.fillWidth: true
2017-11-17 10:33:14 +00:00
text: currentAppPath || ""
}
}
2017-09-02 08:07:07 +00:00
}