From d1f32fb083cbb48e1baeda3f280c0dd838c0eb2c Mon Sep 17 00:00:00 2001 From: Eike Hein Date: Fri, 17 Jun 2016 04:31:15 +0900 Subject: [PATCH] Fix cache invalidation for TasksModel::launcherCount. Fixes regression from 6e72674a. Testers: dfaure BUG:364378 --- libtaskmanager/tasksmodel.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libtaskmanager/tasksmodel.cpp b/libtaskmanager/tasksmodel.cpp index a85de1640..298a22a3d 100644 --- a/libtaskmanager/tasksmodel.cpp +++ b/libtaskmanager/tasksmodel.cpp @@ -207,12 +207,6 @@ void TasksModel::Private::initModels() launcherTasksModel = new LauncherTasksModel(q); QObject::connect(launcherTasksModel, &LauncherTasksModel::launcherListChanged, q, &TasksModel::launcherListChanged); - QObject::connect(launcherTasksModel, &QAbstractItemModel::rowsInserted, - q, &TasksModel::updateLauncherCount); - QObject::connect(launcherTasksModel, &QAbstractItemModel::rowsRemoved, - q, &TasksModel::updateLauncherCount); - QObject::connect(launcherTasksModel, &QAbstractItemModel::modelReset, - q, &TasksModel::updateLauncherCount); concatProxyModel = new ConcatenateTasksProxyModel(q); @@ -429,6 +423,10 @@ void TasksModel::Private::initModels() abstractTasksSourceModel = groupingProxyModel; q->setSourceModel(groupingProxyModel); + QObject::connect(q, &QAbstractItemModel::rowsInserted, q, &TasksModel::updateLauncherCount); + QObject::connect(q, &QAbstractItemModel::rowsRemoved, q, &TasksModel::updateLauncherCount); + QObject::connect(q, &QAbstractItemModel::modelReset, q, &TasksModel::updateLauncherCount); + QObject::connect(q, &QAbstractItemModel::rowsInserted, q, &TasksModel::countChanged); QObject::connect(q, &QAbstractItemModel::rowsRemoved, q, &TasksModel::countChanged); QObject::connect(q, &QAbstractItemModel::modelReset, q, &TasksModel::countChanged); @@ -1548,8 +1546,6 @@ bool TasksModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent if ((!appId.isEmpty() && appId == filteredAppId) || (launcherUrl.isValid() && launcherUrlsMatch(launcherUrl, filteredIndex.data(AbstractTasksModel::LauncherUrl).toUrl(), IgnoreQueryItems))) { - // TODO: Do this outside of filterAcceptsRow, based on notification that something changed. - QMetaObject::invokeMethod(const_cast(this), "updateLauncherCount", Qt::QueuedConnection); return false; } }