Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/plugin/backend.cpp
Show All 36 Lines | |||||
37 | #include <KConfigGroup> | 37 | #include <KConfigGroup> | ||
38 | #include <KDesktopFile> | 38 | #include <KDesktopFile> | ||
39 | #include <KFileItem> | 39 | #include <KFileItem> | ||
40 | #include <KLocalizedString> | 40 | #include <KLocalizedString> | ||
41 | #include <KRun> | 41 | #include <KRun> | ||
42 | #include <KService> | 42 | #include <KService> | ||
43 | #include <kwindoweffects.h> | 43 | #include <kwindoweffects.h> | ||
44 | 44 | | |||
45 | #include <KActivities/Consumer> | ||||
45 | #include <KActivitiesExperimentalStats/Cleaning> | 46 | #include <KActivitiesExperimentalStats/Cleaning> | ||
46 | #include <KActivitiesExperimentalStats/ResultSet> | 47 | #include <KActivitiesExperimentalStats/ResultSet> | ||
47 | #include <KActivitiesExperimentalStats/Terms> | 48 | #include <KActivitiesExperimentalStats/Terms> | ||
48 | 49 | | |||
49 | namespace KAStats = KActivities::Experimental::Stats; | 50 | namespace KAStats = KActivities::Experimental::Stats; | ||
50 | 51 | | |||
51 | using namespace KAStats; | 52 | using namespace KAStats; | ||
52 | using namespace KAStats::Terms; | 53 | using namespace KAStats::Terms; | ||
53 | 54 | | |||
54 | Backend::Backend(QObject* parent) : QObject(parent), | 55 | Backend::Backend(QObject* parent) : QObject(parent), | ||
55 | m_groupManager(new TaskManager::GroupManager(this)), | 56 | m_groupManager(new TaskManager::GroupManager(this)), | ||
56 | m_tasksModel(new TaskManager::TasksModel(m_groupManager, this)), | 57 | m_tasksModel(new TaskManager::TasksModel(m_groupManager, this)), | ||
57 | m_contextMenu(0), | 58 | m_contextMenu(0), | ||
58 | m_taskManagerItem(0), | 59 | m_taskManagerItem(0), | ||
59 | m_toolTipItem(0), | 60 | m_toolTipItem(0), | ||
60 | m_panelWinId(0), | 61 | m_panelWinId(0), | ||
61 | m_highlightWindows(false) | 62 | m_highlightWindows(false), | ||
63 | m_activitiesConsumer(new KActivities::Consumer(this)) | ||||
62 | { | 64 | { | ||
63 | connect(m_groupManager, SIGNAL(launcherListChanged()), this, SLOT(updateLaunchersCache())); | 65 | connect(m_groupManager, SIGNAL(launcherListChanged()), this, SLOT(updateLaunchersCache())); | ||
64 | } | 66 | } | ||
65 | 67 | | |||
66 | Backend::~Backend() | 68 | Backend::~Backend() | ||
67 | { | 69 | { | ||
68 | delete m_contextMenu; | 70 | delete m_contextMenu; | ||
69 | } | 71 | } | ||
▲ Show 20 Lines • Show All 553 Lines • ▼ Show 20 Line(s) | 624 | { | |||
623 | return (KWindowSystem::compositingActive() && KWindowEffects::isEffectAvailable(KWindowEffects::PresentWindowsGroup)); | 625 | return (KWindowSystem::compositingActive() && KWindowEffects::isEffectAvailable(KWindowEffects::PresentWindowsGroup)); | ||
624 | } | 626 | } | ||
625 | 627 | | |||
626 | int Backend::numberOfDesktops() const | 628 | int Backend::numberOfDesktops() const | ||
627 | { | 629 | { | ||
628 | return KWindowSystem::numberOfDesktops(); | 630 | return KWindowSystem::numberOfDesktops(); | ||
629 | } | 631 | } | ||
630 | 632 | | |||
633 | int Backend::numberOfActivities() const | ||||
634 | { | ||||
635 | return m_activitiesConsumer->activities(KActivities::Info::State::Running).count(); | ||||
davidedmundson: you've effectively got a race condition as to whether the task delegate is created before or… | |||||
636 | } | ||||
637 | | ||||
631 | void Backend::presentWindows(int groupParentId) | 638 | void Backend::presentWindows(int groupParentId) | ||
632 | { | 639 | { | ||
633 | TaskManager::AbstractGroupableItem *item = m_groupManager->rootGroup()->getMemberById(groupParentId); | 640 | TaskManager::AbstractGroupableItem *item = m_groupManager->rootGroup()->getMemberById(groupParentId); | ||
634 | 641 | | |||
635 | if (item && m_taskManagerItem && m_taskManagerItem->window()) { | 642 | if (item && m_taskManagerItem && m_taskManagerItem->window()) { | ||
636 | if (m_windowsToHighlight.count()) { | 643 | if (m_windowsToHighlight.count()) { | ||
637 | m_windowsToHighlight.clear(); | 644 | m_windowsToHighlight.clear(); | ||
638 | updateWindowHighlight(); | 645 | updateWindowHighlight(); | ||
Show All 18 Lines |
you've effectively got a race condition as to whether the task delegate is created before or after the activities consumer loads.