Commit b347fcc0 authored by David Redondo's avatar David Redondo 🏎
Browse files

Do not set root twice when constructing ApplicationDataModel

Otherwise it will trigger two processes updates
parent 5b09cb7d
......@@ -25,10 +25,8 @@
using namespace KSysGuard;
ApplicationDataModel::ApplicationDataModel(QObject *parent)
: CGroupDataModel(parent)
: CGroupDataModel(QStringLiteral("/user.slice/user-%1.slice/user@%1.service").arg(KUserId::currentEffectiveUserId().toString()), parent)
{
const QString userId = KUserId::currentEffectiveUserId().toString();
setRoot(QStringLiteral("/user.slice/user-%1.slice/user@%1.service").arg(userId));
}
bool ApplicationDataModel::filterAcceptsCGroup(const QString &id)
......
......@@ -93,6 +93,11 @@ public:
};
CGroupDataModel::CGroupDataModel(QObject *parent)
: CGroupDataModel(QStringLiteral("/"), parent)
{
}
CGroupDataModel::CGroupDataModel(const QString &root, QObject *parent)
: QAbstractItemModel(parent)
, d(new CGroupDataModelPrivate)
{
......@@ -118,7 +123,7 @@ CGroupDataModel::CGroupDataModel(QObject *parent)
d->m_updateTimer->setInterval(2000);
d->m_updateTimer->start();
setRoot(QStringLiteral("/"));
setRoot(root);
}
CGroupDataModel::~CGroupDataModel()
......
......@@ -61,6 +61,7 @@ class Q_DECL_EXPORT CGroupDataModel : public QAbstractItemModel
public:
CGroupDataModel(QObject *parent = nullptr);
CGroupDataModel(const QString &root, QObject *parent = nullptr);
~CGroupDataModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment