File indexing completed on 2024-04-28 05:31:35

0001 /*
0002     SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "application_data_model.h"
0008 #include <KUser>
0009 
0010 #include <QDebug>
0011 
0012 using namespace KSysGuard;
0013 
0014 ApplicationDataModel::ApplicationDataModel(QObject *parent)
0015     : CGroupDataModel(QStringLiteral("/user.slice/user-%1.slice/user@%1.service").arg(KUserId::currentEffectiveUserId().toString()), parent)
0016 {
0017 }
0018 
0019 bool ApplicationDataModel::filterAcceptsCGroup(const QString &id)
0020 {
0021     if (!CGroupDataModel::filterAcceptsCGroup(id)) {
0022         return false;
0023     }
0024     // this class is all temporary. In the future as per https://systemd.io/DESKTOP_ENVIRONMENTS/
0025     // all apps will have a managed by a drop-in that puts apps in the app.slice
0026     // when this happens adjust the root above and drop this filterAcceptsCGroup line
0027     return id.contains(QLatin1String("/app-")) || (id.contains(QLatin1String("/flatpak")) && id.endsWith(QLatin1String("scope")));
0028 }