UI: Improve app groups handling.

This commit is contained in:
Nodir Temirkhodjaev 2017-09-05 19:32:11 +05:00
parent b8c58cce82
commit 9e32f39fb1
3 changed files with 24 additions and 15 deletions

View File

@ -155,7 +155,7 @@ BasePage {
Switch {
id: cbShowBlockedApps
text: QT_TRANSLATE_NOOP("qml", "Show Blocked Applications and Addresses")
text: QT_TRANSLATE_NOOP("qml", "Log Blocked Applications")
onToggled: switchLogReading(checked)
}
}

View File

@ -14,6 +14,26 @@ BasePage {
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) {
var toIndex = index + step;
if (toIndex < 0)
@ -37,21 +57,12 @@ BasePage {
Button {
enabled: editGroupName.text
text: QT_TRANSLATE_NOOP("qml", "Add Group")
onClicked: {
const lastIndex = appGroups.length;
firewallConf.addAppGroupByName(editGroupName.text);
barGroups.currentIndex = lastIndex;
resetGroupName();
}
onClicked: addAppGroup()
}
Button {
enabled: editGroupName.text && appsColumn.enabled
text: QT_TRANSLATE_NOOP("qml", "Rename Group")
onClicked: {
const appGroup = appsColumn.appGroup;
appGroup.name = editGroupName.text;
resetGroupName();
}
onClicked: removeAppGroup()
}
Item {

View File

@ -11,9 +11,7 @@ ColumnLayout {
RowLayout {
Button {
text: QT_TRANSLATE_NOOP("qml", "Remove Group")
onClicked: {
firewallConf.removeAppGroup(index, index);
}
onClicked: removeAppGroup(index)
}
Button {
text: QT_TRANSLATE_NOOP("qml", "Move left")