mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:25:40 +00:00
UI: Improve app groups handling.
This commit is contained in:
parent
b8c58cce82
commit
9e32f39fb1
@ -155,7 +155,7 @@ BasePage {
|
|||||||
|
|
||||||
Switch {
|
Switch {
|
||||||
id: cbShowBlockedApps
|
id: cbShowBlockedApps
|
||||||
text: QT_TRANSLATE_NOOP("qml", "Show Blocked Applications and Addresses")
|
text: QT_TRANSLATE_NOOP("qml", "Log Blocked Applications")
|
||||||
onToggled: switchLogReading(checked)
|
onToggled: switchLogReading(checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,26 @@ BasePage {
|
|||||||
editGroupName.forceActiveFocus();
|
editGroupName.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addAppGroup() {
|
||||||
|
const lastIndex = appGroups.length;
|
||||||
|
firewallConf.addAppGroupByName(editGroupName.text);
|
||||||
|
barGroups.currentIndex = lastIndex;
|
||||||
|
resetGroupName();
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAppGroup(index) {
|
||||||
|
firewallConf.removeAppGroup(index, index);
|
||||||
|
var lastIndex = appGroupsCount - 1;
|
||||||
|
barGroups.currentIndex = (index < appGroupsCount)
|
||||||
|
? index : appGroupsCount - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renameAppGroup() {
|
||||||
|
const appGroup = appsColumn.appGroup;
|
||||||
|
appGroup.name = editGroupName.text;
|
||||||
|
resetGroupName();
|
||||||
|
}
|
||||||
|
|
||||||
function moveAppGroup(index, step) {
|
function moveAppGroup(index, step) {
|
||||||
var toIndex = index + step;
|
var toIndex = index + step;
|
||||||
if (toIndex < 0)
|
if (toIndex < 0)
|
||||||
@ -37,21 +57,12 @@ BasePage {
|
|||||||
Button {
|
Button {
|
||||||
enabled: editGroupName.text
|
enabled: editGroupName.text
|
||||||
text: QT_TRANSLATE_NOOP("qml", "Add Group")
|
text: QT_TRANSLATE_NOOP("qml", "Add Group")
|
||||||
onClicked: {
|
onClicked: addAppGroup()
|
||||||
const lastIndex = appGroups.length;
|
|
||||||
firewallConf.addAppGroupByName(editGroupName.text);
|
|
||||||
barGroups.currentIndex = lastIndex;
|
|
||||||
resetGroupName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
enabled: editGroupName.text && appsColumn.enabled
|
enabled: editGroupName.text && appsColumn.enabled
|
||||||
text: QT_TRANSLATE_NOOP("qml", "Rename Group")
|
text: QT_TRANSLATE_NOOP("qml", "Rename Group")
|
||||||
onClicked: {
|
onClicked: removeAppGroup()
|
||||||
const appGroup = appsColumn.appGroup;
|
|
||||||
appGroup.name = editGroupName.text;
|
|
||||||
resetGroupName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -11,9 +11,7 @@ ColumnLayout {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Button {
|
Button {
|
||||||
text: QT_TRANSLATE_NOOP("qml", "Remove Group")
|
text: QT_TRANSLATE_NOOP("qml", "Remove Group")
|
||||||
onClicked: {
|
onClicked: removeAppGroup(index)
|
||||||
firewallConf.removeAppGroup(index, index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
text: QT_TRANSLATE_NOOP("qml", "Move left")
|
text: QT_TRANSLATE_NOOP("qml", "Move left")
|
||||||
|
Loading…
Reference in New Issue
Block a user