This commit is contained in:
Anton K. 2025-07-08 23:08:01 +08:00 committed by GitHub
commit e25131e7d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View file

@ -26,9 +26,12 @@ QVariant AppSplitTunnelingModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
switch (role) { switch (role) {
case AppPathRole: { case AppNameRole: {
return m_apps.at(index.row()).appName; return m_apps.at(index.row()).appName;
} }
case AppPathRole: {
return m_apps.at(index.row()).appPath;
}
default: { default: {
return true; return true;
} }
@ -89,6 +92,7 @@ void AppSplitTunnelingModel::toggleSplitTunneling(bool enabled)
QHash<int, QByteArray> AppSplitTunnelingModel::roleNames() const QHash<int, QByteArray> AppSplitTunnelingModel::roleNames() const
{ {
QHash<int, QByteArray> roles; QHash<int, QByteArray> roles;
roles[AppNameRole] = "appName";
roles[AppPathRole] = "appPath"; roles[AppPathRole] = "appPath";
return roles; return roles;
} }

View file

@ -12,7 +12,8 @@ class AppSplitTunnelingModel: public QAbstractListModel
public: public:
enum Roles { enum Roles {
AppPathRole = Qt::UserRole + 1, AppNameRole = Qt::UserRole + 1,
AppPathRole,
PackageAppNameRole, PackageAppNameRole,
PackageAppIconRole PackageAppIconRole
}; };

View file

@ -168,11 +168,12 @@ PageType {
id: proxyAppSplitTunnelingModel id: proxyAppSplitTunnelingModel
sourceModel: AppSplitTunnelingModel sourceModel: AppSplitTunnelingModel
filters: RegExpFilter { filters: RegExpFilter {
roleName: "appPath" roleName: "appName"
pattern: ".*" + searchField.textField.text + ".*" pattern: ".*" + searchField.textField.text + ".*"
caseSensitivity: Qt.CaseInsensitive caseSensitivity: Qt.CaseInsensitive
} }
sorters: [ sorters: [
RoleSorter { roleName: "appName"; sortOrder: Qt.AscendingOrder },
RoleSorter { roleName: "appPath"; sortOrder: Qt.AscendingOrder } RoleSorter { roleName: "appPath"; sortOrder: Qt.AscendingOrder }
] ]
} }
@ -194,12 +195,13 @@ PageType {
LabelWithButtonType { LabelWithButtonType {
Layout.fillWidth: true Layout.fillWidth: true
text: appPath text: appName
descriptionText: appPath
rightImageSource: "qrc:/images/controls/trash.svg" rightImageSource: "qrc:/images/controls/trash.svg"
rightImageColor: AmneziaStyle.color.paleGray rightImageColor: AmneziaStyle.color.paleGray
clickedFunction: function() { clickedFunction: function() {
var headerText = qsTr("Remove ") + appPath + "?" var headerText = qsTr("Remove ") + appName + "?"
var yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")