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

View file

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

View file

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