diff -Naur kde-workspace-4.7.0-orig/libs/taskmanager/groupmanager.cpp kde-workspace-4.7.0-patched/libs/taskmanager/groupmanager.cpp --- kde-workspace-4.7.0-orig/libs/taskmanager/groupmanager.cpp 2011-05-20 22:32:08.000000000 +0200 +++ kde-workspace-4.7.0-patched/libs/taskmanager/groupmanager.cpp 2011-08-04 14:27:36.991860818 +0200 @@ -342,6 +342,10 @@ return; } + foreach (LauncherItem *launcher, launchers) { + launcher->removeItemIfAssociated(item); + } + if (item->parentGroup()) { item->parentGroup()->remove(item); } @@ -416,7 +420,11 @@ currentActivity = newActivity; foreach (LauncherItem *item, launchers) { - rootGroups[currentActivity][currentDesktop]->add(item); + if (item->shouldShow()) { + rootGroups[currentActivity][currentDesktop]->add(item); + } else { + rootGroups[currentActivity][currentDesktop]->remove(item); + } } if (onlyGroupWhenFull) { @@ -454,7 +462,11 @@ currentDesktop = newDesktop; foreach (LauncherItem *item, launchers) { - rootGroups[currentActivity][currentDesktop]->add(item); + if (item->shouldShow()) { + rootGroups[currentActivity][currentDesktop]->add(item); + } else { + rootGroups[currentActivity][currentDesktop]->remove(item); + } } if (onlyGroupWhenFull) { @@ -660,15 +672,10 @@ return; } - typedef QHash Metagroup; - foreach (Metagroup metagroup, rootGroups) { - foreach (TaskGroup *rootGroup, metagroup) { - if (launcher->shouldShow()) { - rootGroup->add(launcher); - } else { - rootGroup->remove(launcher); - } - } + if (launcher->shouldShow()) { + rootGroups[currentActivity][currentDesktop]->add(launcher); + } else { + rootGroups[currentActivity][currentDesktop]->remove(launcher); } } diff -Naur kde-workspace-4.7.0-orig/libs/taskmanager/launcheritem.cpp kde-workspace-4.7.0-patched/libs/taskmanager/launcheritem.cpp --- kde-workspace-4.7.0-orig/libs/taskmanager/launcheritem.cpp 2011-05-20 22:32:08.000000000 +0200 +++ kde-workspace-4.7.0-patched/libs/taskmanager/launcheritem.cpp 2011-08-04 14:15:15.938125265 +0200 @@ -120,7 +120,13 @@ bool LauncherItem::shouldShow() const { - return d->associates.isEmpty(); + foreach (QObject *obj, d->associates) { + TaskItem *item = static_cast(obj); + if (item && item->isOnCurrentDesktop() && item->task().data()->isOnCurrentActivity()) { + return false; + } + } + return true; } void LauncherItemPrivate::associateDestroyed(QObject *obj)