UI: Add buttons to move app groups.

This commit is contained in:
Nodir Temirkhodjaev 2017-09-05 19:12:31 +05:00
parent e72ce0546e
commit b8c58cce82
2 changed files with 22 additions and 2 deletions

View File

@ -7,18 +7,30 @@ import com.fortfirewall 1.0
BasePage { BasePage {
readonly property var appGroups: firewallConf.appGroups readonly property var appGroups: firewallConf.appGroups
readonly property int appGroupsCount: appGroups.length
function resetGroupName() { function resetGroupName() {
editGroupName.text = ""; editGroupName.text = "";
editGroupName.forceActiveFocus(); editGroupName.forceActiveFocus();
} }
function moveAppGroup(index, step) {
var toIndex = index + step;
if (toIndex < 0)
toIndex = appGroupsCount - 1;
else if (toIndex >= appGroupsCount)
toIndex = 0;
firewallConf.moveAppGroup(index, toIndex);
barGroups.currentIndex = toIndex;
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
RowLayout { RowLayout {
TextField { TextField {
enabled: rptAppGroups.count < 16 enabled: appGroupsCount < 16
id: editGroupName id: editGroupName
placeholderText: QT_TRANSLATE_NOOP("qml", "Group Name") placeholderText: QT_TRANSLATE_NOOP("qml", "Group Name")
} }

View File

@ -15,6 +15,14 @@ ColumnLayout {
firewallConf.removeAppGroup(index, index); firewallConf.removeAppGroup(index, index);
} }
} }
Button {
text: QT_TRANSLATE_NOOP("qml", "Move left")
onClicked: moveAppGroup(index, -1)
}
Button {
text: QT_TRANSLATE_NOOP("qml", "Move right")
onClicked: moveAppGroup(index, 1)
}
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -41,7 +49,6 @@ ColumnLayout {
textArea { textArea {
placeholderText: " placeholderText: "
System
C:\\Program Files\\Internet Explorer\\iexplore.exe C:\\Program Files\\Internet Explorer\\iexplore.exe
" "
text: appGroup.blockText text: appGroup.blockText
@ -59,6 +66,7 @@ C:\\Program Files\\Internet Explorer\\iexplore.exe
textArea { textArea {
placeholderText: " placeholderText: "
System
C:\\Program Files\\Skype\\Phone\\Skype.exe C:\\Program Files\\Skype\\Phone\\Skype.exe
" "
text: appGroup.allowText text: appGroup.allowText