app split tunneling search field (#727)

This commit is contained in:
Nethius 2024-04-06 22:29:51 +07:00 committed by GitHub
parent 7db84122f9
commit e39efb1d68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 93 additions and 38 deletions

View file

@ -59,8 +59,6 @@ DrawerType2 {
Layout.fillWidth: true
Layout.topMargin: 16
enabled: !ServersModel.isDefaultServerDefaultContainerHasSplitTunneling || !ServersModel.getDefaultServerData("isServerFromApi")
text: qsTr("Site-based split tunneling")
descriptionText: enabled && SitesModel.isTunnelingEnabled ? qsTr("Enabled") : qsTr("Disabled")
rightImageSource: "qrc:/images/controls/chevron-right.svg"

View file

@ -5,6 +5,8 @@ import QtQuick.Layouts
import "../Controls2"
import "../Controls2/TextTypes"
import SortFilterProxyModel 0.2
import InstalledAppsModel 1.0
DrawerType2 {
@ -34,7 +36,7 @@ DrawerType2 {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: addButton.top
anchors.bottom: searchField.top
anchors.topMargin: 16
BackButtonType {
@ -66,7 +68,15 @@ DrawerType2 {
clip: true
interactive: true
model: installedAppsModel
model: SortFilterProxyModel {
id: proxyInstalledAppsModel
sourceModel: installedAppsModel
filters: RegExpFilter {
roleName: "appName"
pattern: ".*" + searchField.textField.text + ".*"
caseSensitivity: Qt.CaseInsensitive
}
}
ScrollBar.vertical: ScrollBar {
id: scrollBar
@ -93,7 +103,7 @@ DrawerType2 {
text: appName
onCheckedChanged: {
listView.model.selectedStateChanged(index, checked)
installedAppsModel.selectedStateChanged(proxyInstalledAppsModel.mapToSource(index), checked)
}
}
@ -113,6 +123,21 @@ DrawerType2 {
}
}
TextFieldWithHeaderType {
id: searchField
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: addButton.top
anchors.bottomMargin: 16
anchors.rightMargin: 16
anchors.leftMargin: 16
backgroundColor: "#2C2D30"
textFieldPlaceholderText: qsTr("application name")
}
BasicButtonType {
id: addButton
@ -127,7 +152,7 @@ DrawerType2 {
clickedFunc: function() {
PageController.showBusyIndicator(true)
AppSplitTunnelingController.addApps(listView.model.getSelectedAppsInfo())
AppSplitTunnelingController.addApps(installedAppsModel.getSelectedAppsInfo())
PageController.showBusyIndicator(false)
root.close()
}

View file

@ -20,6 +20,17 @@ import "../Components"
PageType {
id: root
property bool pageEnabled
Component.onCompleted: {
if (ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot change split tunneling settings during active connection"))
root.pageEnabled = false
} else {
root.pageEnabled = true
}
}
QtObject {
id: routeMode
property int allApps: 0
@ -70,6 +81,8 @@ PageType {
Layout.leftMargin: 16
headerText: qsTr("App split tunneling")
enabled: root.pageEnabled
}
SwitcherType {
@ -78,6 +91,8 @@ PageType {
Layout.fillWidth: true
Layout.rightMargin: 16
enabled: root.pageEnabled
checked: AppSplitTunnelingModel.isTunnelingEnabled
onToggled: {
AppSplitTunnelingModel.toggleSplitTunneling(checked)
@ -99,7 +114,7 @@ PageType {
headerText: qsTr("Mode")
enabled: Qt.platform.os === "android"
enabled: Qt.platform.os === "android" && root.pageEnabled
listView: ListViewWithRadioButtonType {
rootWidth: root.width
@ -139,6 +154,8 @@ PageType {
anchors.topMargin: 16
contentHeight: col.implicitHeight + addAppButton.implicitHeight + addAppButton.anchors.bottomMargin + addAppButton.anchors.topMargin
enabled: root.pageEnabled
Column {
id: col
anchors.top: parent.top
@ -213,6 +230,8 @@ PageType {
RowLayout {
id: addAppButton
enabled: root.pageEnabled
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right

View file

@ -24,9 +24,7 @@ PageType {
defaultActiveFocusItem: searchField.textField
property bool pageEnabled: {
return !ConnectionController.isConnected && !isServerFromApi
}
property bool pageEnabled
Component.onCompleted: {
if (ConnectionController.isConnected) {